SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Guru DeNasio's Avatar
    Join Date
    May 2001
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Code does not work when using DOCTYPE declaration !!

    Hello,

    I have the following code on my documents:

    Code:
    <table border="1"><tr id="help" style="display: none"><td align="left" bgcolor="#ffffcc" colspan="2">
    Username is a short combination of letters and/or numbers uniquely identifying your account</td></tr>
    <tr><td align="left" width="50%">Username&nbsp;&nbsp;
    <a onclick="document.all.help.style.display = document.all.help.style.display=='none' ? '' : 'none'" href="#">??</a>
    </td><td align="left" width="50%"><input type="text" name="username" /></td></tr></table>
    The code seems to be working perfectly when I do not use the DOCTYPE declaration, but stops working when I do use it. Does anyone know how I can tweak this code so that it will work when using the DOCTYPE declaration?
    Ballot-Box.net - free polls for webmasters
    FormLog.com - free form processor

  2. #2
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you'd be better using getDocumentByID instead of document.all and it would be better if the script was applied unobtrusively.

  3. #3
    SitePoint Guru DeNasio's Avatar
    Join Date
    May 2001
    Posts
    830
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Tyssen
    I think you'd be better using getDocumentByID instead of document.all
    Nope, doesn't seem to work either.
    Ballot-Box.net - free polls for webmasters
    FormLog.com - free form processor

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Also getting rid of the inline styles and moving them to an external stylesheet would help as well.

    Also, and this is a very important question, was the DOCTYPE written properly?

  5. #5
    \m/\m/ karinne's Avatar
    Join Date
    Dec 2002
    Location
    Aylmer, QC, Canada
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Schulz
    Also, and this is a very important question, was the DOCTYPE written properly?
    That's a common problem.

    Make sure you have the proper "full" DOCTYPE - Recommended DTDs to use in your Web document.


Bookmarks

Posting Permissions

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