SitePoint Sponsor

User Tag List

Results 1 to 13 of 13

Thread: Vaildation help needed (with javascript codes)

  1. #1
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    919
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Vaildation help needed (with javascript codes)

    Hi all,

    I have tried to solve my whole lot of vaildation errors the whole afternoon...I used the following to vaildate my webpage:

    http://www.htmlvalidator.com/

    And my webpage is:

    http://www.absolutethree.com

    The first error generated is that it says that it can't find an end tag for the <div id='frame'> but i looked through the whole file and the tag is in order...my layout for the divs is:
    Code:
    <div id=frame>    // frame starts here
     <div id=buttonarea></div>    // this is for the button area
     <div id=contentleft></div>    // this is for the left area
     <div id=contentcenter></div>    // this is for the center area
    
    </div> // end frame
    My second problem is that the vaildator says:

    The "a" tag has a misplaced or invalid equal sign ('='). Cannot check the rest of the tag.

    ...based game in Singapore'></a><div id='buttonarea'><a href="register.php?PHPSESSID=6bad26a6c944dc812695d15f51821ca2" onMouseOver=document.signuppic.src="images/button_signupon.gif" onMouseOut=document.signuppic.src="images/button_signup.gif"><img class="firstbuttonpos" src="images/button_signup.gif" n...


    The above line refers to this code:
    PHP Code:
    echo'<a href="register.php" onMouseOver=document.signuppic.src="images/button_signupon.gif" onMouseOut=document.signuppic.src="images/button_signup.gif"><img class="firstbuttonpos" src="images/button_signup.gif" name="signuppic" alt="Sign up for a new adventure!" title="Sign up for a new adventure!"></a>'
    I tried to amend the quotes but just can't get pass the vaildation...the code is working fine...

    Any help / advice will be greatly appreciated. Thank you.

  2. #2
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Get yourself a character set. Something like this will be OK :
    Code:
    <meta http-equiv='Content-Type' content='text/html; charset=ISO-8859-1'>
    The W3C validator won't accept your page without this.

  3. #3
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    echo'<a href="register.php" onmouseover="document.signuppic.src=\'images/button_signupon.gif\'" onmouseout="document.signuppic.src=\'images/button_signup.gif\'"><img class="firstbuttonpos" src="images/button_signup.gif" name="signuppic" alt="Sign up" title="Sign up for a new adventure!"></a>'
    Simon Pieters

  4. #4
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    919
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the help again, BonRouge. And zcorpan also

    I have managed to solve the vaildation errors down to 2..
    I believe these 2 errors are somehow linked with each other..does anyone has any idea of the missing tags??

    LINE 15
    The "div" tag must have an end tag but the end tag was not found.

    </head><body><div id='frame'><a href='index.php?PHPSESSID=00e97aa94540cc736b5e7562444cf34e'><img src='images/header.jpg' width='770' height='120' alt='An unique browse...



    LINE 118
    The end tag for "div" (opened in line 15) should appear before the end tag for "body" (nesting error).

    ...2005 by KC TAN and listed <a href='credits.php?PHPSESSID=00e97aa94540cc736b5e7562444cf34e'>Contributors</a><br>All Rights Reserved</span></div></div></body></html>


    I have checked this several times but still could'nt figure out what's wrong

    Any further help will be greatly appreciated. Thank you.

  5. #5
    Winemaster bronze trophy BonRouge's Avatar
    Join Date
    Oct 2004
    Location
    Sendai, Japan
    Posts
    2,417
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think you should check this validator.

  6. #6
    The CSS Clinic is open silver trophybronze trophy
    SitePoint Award Recipient Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    37,796
    Mentioned
    99 Post(s)
    Tagged
    3 Thread(s)
    As BonRouge said above the w3c validator show 39 errors.

    All are easily fixed:

    <script type="text/JavaScript"> not language="text/javascript"

    You have used the same id's loads of time but an id is unique and can only be used once. Change the id's to classes instead as classes are re-usable.

    You have a missing closing div for #frame so I assume the closing div should be right at the bottom of the page. You also have missing closing tags for a couple of inline elements such as b and i.

    Add alt descriptions to your images (alt="description of picture")

    Shouldn't take more than a few minutes to fix

  7. #7
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    919
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow...

    So many vaildators with different results...ok, think i'll follow this vaildator

    Will update here if i still encounter any problems . Thanks a lot^^

  8. #8
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    919
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I'm sorry that i have to dig out an old thread..I am currently trying my best to vaildate my homepage with the vaildator recommended by you guys

    http://validator.w3.org/check?uri=ht...olutethree.com

    However, I ran into some problem..I got several errors saying that

    end tag for element "B" which is not open.

    But it is already opened (in javascripts)

    Code:
    <script type="text/javascript">
    messages[0]="<font color='red'><b>Welcome to Absolute III, we are currently doing some Internal testing</b><br><div align='right'><i>--Chief Developer</i></font></div>"
    </script>
    Can someone help me out on this one? I'm sooo close..

  9. #9
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't have the sequence "</" inside a SCRIPT element, because they terminate the SCRIPT element itself (they are equivalent to "</script>").

    The best way is to make the JavaScript external (put it in a separate file). The next best thing is to escape the slashes:
    HTML Code:
    <script type="text/javascript">
    messages[0]="<font color='red'><b>Welcome to Absolute III, we are currently doing some Internal testing<\/b><br><div align='right'><i>--Chief Developer<\/i><\/font><\/div>"
    </script>
    (Note the backslash ('\') characters between each '<' and '/'.)

    That code snippet is malformed, though. You terminate the <font> before the <div>, although the <div> is inside the <font>. Even if you correct that error, it's still invalid, because a block-level DIV cannot exist inside an inline-level FONT.

    (I didn't think anyone actually used <font> elements these days!)
    Birnam wood is come to Dunsinane

  10. #10
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    919
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the vaulable advice, AutisticCuckoo

    I have passed the vaildation test

    Also would like to thank those guys that has helped me a lot in this issue. hmm...by the way, can anyone highlight to me the importance of vaildation?

    Is it make webpage more search engine friendly? To make it cross-browser compatible? Or simply just to correct bad coding habits
    Last edited by KCgame; Aug 8, 2005 at 17:25. Reason: Typo correction

  11. #11
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,666
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by KCgame
    Is it make webpage more search engine friendly? To make it cross-browser compatible? Or simply just to correct bad coding habits
    Yes, yes, and yes, respectively.

    Also note that:
    HTML Code:
    <p><script type="text/javascript">
     document.write("<i>foo<b>bar<\/i>baz<\/b>");
    </script></p>
    ...is equally invalid as:
    HTML Code:
    <p><i>foo<b>bar</i>baz</b></p>
    It's just that the markup validator doesn't pick it up.
    Simon Pieters

  12. #12
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,159
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Validation is important, because if you write the markup wrong you can't expect browsers (or assistive technology or search engines) to get it right.

    Most HTML browsers have very good error handling that will recover from dumb errors like improper nesting, but why rely on such a thing? I don't know how good search engines are at error recovery, though.

    And if you use XHTML (real XHTML), such an error will prevent the page from being displayed at all. An XML parser must abort at the first sight of a well-formedness error.

    Other validation errors, like unescaped ampersands, may or may not be a problem (in HTML, they are a problem in XHTML). Again, why risk it?

    A third kind of errors is mismatching the character encoding declaration and the character encoding which is actually used. Like saying that the page is encoded with UTF-8, while in reality it's ISO 8859-1. If you do this, all bets are off.

    Then there is a fourth group of errors: invalid tags or attributes. This is actually less of a problem than one might think. Browsers will simply ignore what they don't understand. But if browsers don't understand it, what's the point in using it?
    Birnam wood is come to Dunsinane

  13. #13
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    919
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm...thanks for sharing the information

    Think i will better start going through my codes again..

    Many thanks to AutisticCuckoo and zcorpan

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
  •