Forum Moderators: open

Message Too Old, No Replies

Java Script and W3C Validation

Problems with a news ticker script and W3C validation

         

bid4abook

2:34 pm on Apr 24, 2009 (gmt 0)

10+ Year Member



I have recently put a news ticker script onto one of my homepages and then went to W3C to validate, using xhtml trans, but I get way too many errors. I had other scripts on the page before this which validated just fine, adsense for example. Anyone out there able to point me in the right direction of a vertical news ticker script that will validate?
Regards b4b.

Fotiman

4:26 pm on Apr 24, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Just put the script into an external file.

<script type="text/javascript" src="newsticker.js"></script>

astupidname

4:41 pm on Apr 25, 2009 (gmt 0)

10+ Year Member



using xhtml trans

When using javascripts within an xhtml page, the code should be wrapped in CDATA tags such as:
<script type="text/javascript">
/*<![CDATA[*/

//js code in here

/*]]>*/
</script>

It is not necessary, however, if the script tag is just a link to an external js file. (External is advised, as Fotiman suggests)

bid4abook

7:29 pm on Apr 25, 2009 (gmt 0)

10+ Year Member



Thanks very much for pointing out both options, novice that I am neither had occurred to me. Regards John.