Javascript and XHTML validation

Discussion in 'HTML & Website Design' started by Synchronium, Aug 22, 2007.

  1. #1
    Hello,

    My site is here and its validation result is here.

    All the errors are from javascript's document.write function writing out some of the xhtml. What's actually wrong with it and how can I fix it?

    Also, is there really any benifit SEO wise to having valid code?
     
    Synchronium, Aug 22, 2007 IP
  2. Stomme poes

    Stomme poes Peon

    Messages:
    3,195
    Likes Received:
    136
    Best Answers:
    0
    Trophy Points:
    0
    #2
    There is benefit to having valid html code, yes. Also a benefit to people with screen-readers, text-only browsers, and people who don't use mice.

    As far as I've learned on this forum, spiders ignore javascript.

    I noticed that while you have a css sheet, you aren't taking full advantage of it.
    <ul class="nav_top">
    				<li><a href="http://www.coffeesh0p.com/disclaimer/" class="nav_top" title="Disclaimer">Disclaimer</a> ::</li>
    Code (markup):
    Why not
    
    ul class="nav_top">
         <li><a href="http://www.coffeesh0p.com/discalimer/">Disclaimer  ::</a></li>
    
    Code (markup):
    I dunno if you need the whole webaddress needed in the link. If your site was made up of .html pages, you would only write href="disclaimer.html"

    I wonder if you could change your doctype (temporarily) to html4.1 to see if that affected anything.
     
    Stomme poes, Aug 22, 2007 IP
  3. Synchronium

    Synchronium Active Member

    Messages:
    463
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks for your reply.

    The problem, I think, is the validator picking up the elements in document.write() and thinking they're inside script tags, which is why they shouldn't be there. I was hoping there was some way to fix it.

    Also, I didn't notice I was still using the classes for each link. I shall remove those now.

    As for the absolute linking, it's just preference. Linking to /disclaimer/ works the exact same was as you suggest with html pages.
     
    Synchronium, Aug 22, 2007 IP
  4. VimF

    VimF Well-Known Member

    Messages:
    307
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    118
    #4
    Just enclose your scripts like this:
    
    <script type="text/javascript"><!--
    
    ...
    
    --></script>
    
    Code (markup):
    and the page will validate.
     
    VimF, Aug 22, 2007 IP
  5. Synchronium

    Synchronium Active Member

    Messages:
    463
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Yesssssss!

    Thanks a lot.
     
    Synchronium, Aug 22, 2007 IP
  6. Synchronium

    Synchronium Active Member

    Messages:
    463
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #6
    Next question: Is it worth it, breaking my colourscheme, looking a bit out of place, to include the validator images?

    I wonder if google looks to see'f you have links to the validator, as a general idea of whether or not a site is valid, and gives you points accordingly? Obviously, no one could know if google did do that, or everyone would link to them, even if the site wasn't valid. That wasn't a serious question btw, I was just thinking up another google conspiracy. :)
     
    Synchronium, Aug 22, 2007 IP