CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1

    Determining the validity of a JavaScript parameter

    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

  2. #2
    Join Date
    Aug 2002
    Location
    Reykjavik, Iceland
    Posts
    201
    <script language="JavaScript" type="text/javascript">

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

  3. #3
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured