dcsimg
www.webdeveloper.com
Results 1 to 2 of 2

Thread: set text field value on page load

  1. #1
    Join Date
    Feb 2011
    Posts
    7

    set text field value on page load

    Hello,

    I have a text field that is for a number. On page load the value is "0.0000"... I want the text field to be blank if the value is indeed "0.0000".

    Obviously the following would be out of the question:

    <form id="form1" onload="load"... will not work.

    Any suggestions on how I can validate and set the value of the text field on page load?

    Please let me know. Also, let me know if you need more details.

    Thanks!

  2. #2
    Join Date
    Feb 2011
    Posts
    7
    Ok... I figured this one out. The following worked for me in the <body></body> of the page I placed the following JavaScript right after the closing </form> tag and it worked perfectly in both Internet Explorer and Mozilla Firefox:

    <script language="javascript">

    if (document.Form1.nQty.value == '0.0000')
    {
    document.Form1.nQty.value = ''
    }

    </script>


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles