Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

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

Posted on 2004-08-18
5
171 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

One of the pain points with developing AJAX, JavaScript, JQuery, and other client-side behaviors is that JavaScript doesn’t allow for cross domain request for pulling content. For example, JavaScript code on www.johnchapman.name could not pull conte…
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

828 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