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 12 of 12
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post

    Impossible to validate a document that uses html in arrays?

    I have a page I'm trying to validate with the http://validator.w3.org and it's claiming that my arrays containing html are in the wrong spot. They're not in a paragraph tag so it complains. But those arrays are written into table cells when used which is perfectly valid. Is this one of those limitations of the validator? I guess not all pages can be validated. The url to the page I'm refering to is http://www.techsonic.net/xfox/goods.

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    hm

    wouldn't be the full syntax of a new class of objects a better way?:

    var C = new Array(44)

    ... but I don't think this is the unvalidate reason....
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's validating the HTML as it sees it - <a> is not allowed as a direct child of <script> and so it throws an error.

    Scripting in XHTML should be in a <![CDATA[ section .. but you shouldn't really put <![CDATA[ sections in HTML, so if you're not serving as XML then the thing to do is take the script out and put it in an external JS file - then the validator won't see it.
    Last edited by brothercake; 12-19-2003 at 11:43 AM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #4
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    I'm not sure about that. It checks for linked files. For an external css file on another page, it validated that as part of the XHTML 1.0 check. http://www.techsonic.net/xfox/old/upd02.htm is the fully redone and validated page so far.

    Edit: Aha, problem solved. It requires comment tags in the script tag. Just regular old comments (I've never encountered a CDATA before).
    Last edited by Tails; 12-19-2003 at 09:16 PM.

  • #5
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No - not comments, never put HTML comments inside <script>. A validating parser is not required to process comments - and indeed, in a page served as XML the script won't run at all.

    But without comments it's visible to legacy browsers. So it's better always to put scripting in external JS files.

    The validator should not be validating external files. Possibly there's an option for validating CSS at the same time, I don't know, but afaik the validator will not open and try to validate an external JS file. It's always worked for me.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #6
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    I've got a few pages fully validated now. But one problem comes up for links. is the &amp; character allowed in urls? Some have them but it says it's a delimiter and shouldn't be used as data. You can't just change an url though can you?

  • #7
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Replaces all instances of & with it's equivalent entity:
    Code:
    &amp;amp;

  • #8
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    Doing that would apparently make the url an invalid link.

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No it wouldn't.
    Last edited by brothercake; 12-20-2003 at 10:06 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #10
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    Ah, okay. It works as long as the browser converts it (I don't think all of them do however). And the address bar doesn't do the conversion if you paste the entity version.

  • #11
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Possibly not, but if you're pasting it you won't use the entitity; and if someone copies-and-pastes it from your page, they'll get a raw ampersand as well, because that's what's displayed. It's when you insert that character in your source code that it needs to be an entity.

    When you say you don't think all browsers will work with that - on what basis are you saying that? Superstition, or you have a practical example of it not working?
    Last edited by brothercake; 12-21-2003 at 01:03 PM.
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

  • #12
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Built a test page, works in IE4-6, Moz. Didn't test it in any others. Anyway, the page:
    Attached Files Attached Files
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!


  •  

    Posting Permissions

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