Solved

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

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
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 …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now