Obtain Textbox Value w/out Form

T

TheVisionThing

I want to retrieve the value of the textbox 'TablePageSize' when I press the
'Go' button, like so:

Page Size <input name="TablePageSize" type="text" size="4" maxlength="4" />
&nbsp;<input name="Go" type="button" value="Go"
onclick="alert(document.TablePageSize.value);"/>

But for various reasons I don't have a form here. How do I refer to the
'TablePageSize' object to get its value.

Regards,
Wayne C.
 
D

David Dorward

TheVisionThing said:
Page Size <input name="TablePageSize" type="text" size="4" maxlength="4"
/> &nbsp;<input name="Go" type="button" value="Go"
onclick="alert(document.TablePageSize.value);"/>

But for various reasons I don't have a form here. How do I refer to the
'TablePageSize' object to get its value.

Give it an id and use document.getElementById, or use
document.getElementsByName.

Better yet, put it in a form and set up a server side fallback.

Oh - and if you plan on serving your document as text/html, then you should
insert a space before "/>".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top