Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2007
    Location
    on earth
    Posts
    183
    Thanks
    49
    Thanked 2 Times in 2 Posts

    doc type and script

    Hi there,
    I am having a hard time trying to understand this:

    The script I am using does not work if I write doctype as follows:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    But it does when removing the link:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" >
    However when I remove the link from the doc type, in IE my selected menu is unaligned;

    Here is the link.

    Have you got an idea about why it does not work with the full doc type?
    Thanks a lot for having a look;

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Code:
    var userInputs = myform.elements;
    The culprit is the above line. The attribute name on form is deprecated and so the old practice to refer a form like above won't work with a standard DOCTYPE.

    I'd recommend the following strict DOCTYPE.
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    Then change your code to
    Code:
    var userInputs = document.forms.myform.elements;
    Code:
    <form id="myform">
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    mikacruz (06-12-2010)


  •  

    Posting Permissions

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