Newbie Question - javascript error in navigator 4.5


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Newbie Question - javascript error in navigator 4.5

  1. #1
    Jeff Murdock Guest

    Newbie Question - javascript error in navigator 4.5


    1. I have a html page with a form where I have a text box (INPUT) called txtLogin.
    2. I also have a button w/onclick event.
    3. When I push button, I want to clear or populate the text box with something
    like:

    window.form1.txtLogin.value="Test text here"

    or clear text box with:

    window.form1.txtLogin.value=""

    4. The problem is that this code works fine with IE but causes a javascript
    error in Navigator.
    button works OK in Navigator if I do something like "alert("Testing Button")
    5. What am I doing wrong?





  2. #2
    Arun N Kumar Guest

    Re: Newbie Question - javascript error in navigator 4.5


    According to the DOM, the form Object is a member(object) to the document
    object. Hence the following code should work

    window.document.form1.txtLogin.value="Test text here"

    or document.form1.txtLogin.value="Test text here"

    Microsoft's Javascript DOM (JScript) is a superset of Netscape's Javascript
    DOM, hence always test your code in Netscape for true Cross-Browser JavaScript
    Code.

    - Arun N Kumar

    "Jeff Murdock" <jeffm@earthlink.net> wrote:
    >
    >1. I have a html page with a form where I have a text box (INPUT) called

    txtLogin.
    >2. I also have a button w/onclick event.
    >3. When I push button, I want to clear or populate the text box with something
    >like:
    >
    >window.form1.txtLogin.value="Test text here"
    >
    >or clear text box with:
    >
    >window.form1.txtLogin.value=""
    >
    >4. The problem is that this code works fine with IE but causes a javascript
    >error in Navigator.
    > button works OK in Navigator if I do something like "alert("Testing

    Button")
    >5. What am I doing wrong?
    >
    >
    >
    >



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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center