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
    Join Date
    Nov 2010
    Posts
    1,487
    Thanks
    279
    Thanked 32 Times in 31 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 06:19 AM.

  • #2
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,487
    Thanks
    279
    Thanked 32 Times in 31 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,461
    Thanks
    11
    Thanked 600 Times in 580 Posts
    you can use a cdata wrapper around the contents of inline script tags or external scripts if you need to validate 1999 doctypes.
    my site (updated 2014/10/20)
    BROWSER STATS [% share] (2014/9/03) IE7:0.1, IE8:4.3, IE11:9.2, IE9:2.7, IE10:2.6, FF:16.8, CH:47.5, SF:7.8, NON-MOUSE:37%

  • Users who have thanked rnd me for this post:

    durangod (05-28-2014)

  • #4
    Senior Coder
    Join Date
    Nov 2010
    Posts
    1,487
    Thanks
    279
    Thanked 32 Times in 31 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
    •