Solved

How do I read the value of a non HTML textbox from JavaScript?

Posted on 2004-08-18
5
172 Views
Last Modified: 2010-04-07
Hi All,

I'm trying to read the value of the textbox called TextBox1 and pass it as follows

<INPUT title="Button" style="Z-INDEX: 115; LEFT: 832px; POSITION: absolute; TOP: 176px"
                        onclick="showAnimation(TextBox1);" type="button" value="Button">

function showAnimation(file) { if (file != '') {
                  WinName = toString(file)
                  alert(WinName)
                  popup(file ,100,100,500,300,file,false,false,false,false,false,true,false);

            }

The popup function is already working, but the "file" parameter in showAnimation is not getting passed.  It should be the Text value of TextBox1.

B-

0
Comment
Question by:bczingo
5 Comments
 
LVL 2

Expert Comment

by:vijay_a73
ID: 11834829
try TextBox1.value
or document.all.TextBox1.value

I believe your function showAnimation() takes the value of textbox as parameter
0
 
LVL 1

Expert Comment

by:steve_mick972
ID: 11834982
Form1.TextBox1.value OR document.all.TextBox1.vale working in my case....

HTH,
Steve...
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11836943
Hi there,

<INPUT title="Button" style="Z-INDEX: 115; LEFT: 832px; POSITION: absolute; TOP: 176px"
                    onclick="showAnimation();" type="button" value="Button">

function showAnimation() { if (file != '') {
               file=document.getElementById('TextBox1').value;
               WinName = toString(file)
               alert(WinName)
               popup(file ,100,100,500,300,file,false,false,false,false,false,true,false);
          }
         
-Baan
0
 
LVL 18

Expert Comment

by:DotNetLover_Baan
ID: 11836955
sorry... about that...
function showAnimation() {
               file=document.getElementById('TextBox1').value;
               if (file != '') {
               WinName = toString(file)
               alert(WinName)
               popup(file ,100,100,500,300,file,false,false,false,false,false,true,false);
          }
   }
0
 
LVL 10

Accepted Solution

by:
jnhorst earned 500 total points
ID: 11855786
Your INPUT tag has an attribute named "title".  I am not sure that is correct.  It should be:

<INPUT id="Button" name="Button" style="{your style settings}" onclick="showAnimation();" type="button">

Baan's code above for getting the file then is right, just make sure the string in getElementById(...) is the same as the string in the id="..." attribute of the INPUT tag.  You had "value='Button'", which would have the word Button in the textbox.  I think (as stated by others above) that this should be the filename af the animation, so I don't think you want to preset that value in the HTML.

John
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question