Click to See Complete Forum and Search --> : Determining the validity of a JavaScript parameter


Jeremy Davis
January 14th, 2003, 11:42 AM
I have a web page that writes a text box to the screen depending on centetain paramters.
if(ok) printf("<input type="text" name="textbox">\n");else printf("Something else");

I then wish to do something IF "textbox" is displayed. I do not then know the state of "ok" so I wish to interrogate textbox to see if it exists.

I there any way to do this in JavaScript?

TIA

websmith99
January 14th, 2003, 01:36 PM
<script language="JavaScript" type="text/javascript">

if (document.yourformname.textbox) {
// the text field is present
} else {
// the text field is not present
}

Jeremy Davis
January 15th, 2003, 05:09 AM
Originally posted by websmith99
<script language="JavaScript" type="text/javascript">

if (document.yourformname.textbox) {
// the text field is present
} else {
// the text field is not present
}

Thanks. Doh! How easy!