Jump to content

Can Javascript be validated


dink

Recommended Posts

Hi all,I am updating my site and have reached the validation point. Everything validates except 4 lines of javascript. Is it even possible to validate javascript? My skill set is not strong in javascript and I would appreciate any help. these are the errors Line 48, Column 26: character "'" is not allowed in the value of attribute "id" document.write('<div id="'+divId+'" class="'+divClass+'" style="position: relat…Line 48, Column 102: document type does not allow element "div" here…"position: relative; overflow: hidden"><div class="innerDiv" style="position: …Line 48, Column 169: character "'" is not allowed in the value of attribute "id"…"position: absolute; width: 100%" id="'+divId+'1">'+content[0]+'</div><div cla…Line 48, Column 287: character "'" is not allowed in the value of attribute "id"…; width: 100%; visibility: hidden" id="'+divId+'2">'+content[1]+'</div></div>')The errors all pertain to this line of 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>')

Thanks for taking the time to look and I appreciate any help!dink

Link to comment
Share on other sites

Those errors are because it's trying to validate the Javascript as HTML code. If this is an XHTML page, you can hide Javascript from the validator by putting the Javascript in a CDATA comment. If you want to do a check on Javascript code specifically you can use the jslint website or program.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...