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 4 of 4
  1. #1
    Senior Coder durangod's Avatar
    Join Date
    Nov 2010
    Location
    southwestern USA
    Posts
    1,634
    Thanks
    314
    Thanked 34 Times in 33 Posts

    getting doc write to pass W3C validation

    Hi,

    im using this to scroll some text in the small box

    Dynamic Drive DHTML Scripts- Pausing up-down Scroller

    and im trying to get it to pass Validation, i have tried to redo this several ways but it still says.

    character "'" is not allowed in the value of attribute "id"
    Code:
    document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relative; overflow: hidden"><div class="innerDiv" style="position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div class="innerDiv" style="position: absolute; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>');
    So i thought about converting this to innerHTML, splitting it up into several vars instead of document write then use innerHTML but i thought i would ask here first to see if its just a simple placing of extra quotes along the way.

    thanks
    Last edited by durangod; 05-28-2014 at 05:19 AM.

  • #2
    Senior Coder durangod's Avatar
    Join Date
    Nov 2010
    Location
    southwestern USA
    Posts
    1,634
    Thanks
    314
    Thanked 34 Times in 33 Posts
    I did just do a alert of divId and i think its because it is a number not a letter) it says NaN on the alert.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,610
    Thanks
    11
    Thanked 619 Times in 599 Posts
    you can use a cdata wrapper around the contents of inline script tags or external scripts if you need to validate 1999 doctypes.
    Create, Share, and Debug HTML pages and snippets with a cool new web app I helped create: pagedemos.com

  • Users who have thanked rnd me for this post:

    durangod (05-28-2014)

  • #4
    Senior Coder durangod's Avatar
    Join Date
    Nov 2010
    Location
    southwestern USA
    Posts
    1,634
    Thanks
    314
    Thanked 34 Times in 33 Posts
    great thanks, that slipped my mind, yep that worked great.. appreciate that


  •  

    Posting Permissions

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