Jump to content

Cre8asiteforums

Web Site Design, Usability, SEO & Marketing Discussion and Support

  • Announcements

    • cre8pc

      20 Years! Cre8asiteforums 1998 - 2018   01/18/2018

      Cre8asiteforums In Its 20th Year In case you didn't know, Internet Marketing Ninjas released many of the online forums they had acquired, such as WebmasterWorld, SEOChat, several DevShed properties and these forums back to their founders. You will notice a new user interface for Cre8asiteforums, the software was upgraded, and it was moved to a new server.  Founder, Kim Krause Berg, who was retained as forums Admin when the forums were sold, is the hotel manager here, with the help of long-time member, "iamlost" as backup. Kim is shouldering the expenses of keeping the place going, so if you have any inclination towards making a donation or putting up a banner, she is most appreciative of your financial support. 
Sign in to follow this  
lirys

Jquery Beginners Troubles W3C Validation

Recommended Posts

got stuck again and been readng this code over and over and just cant find it....

please some one........

http://www.kreativadesign.net/mia/

<script type="text/javascript">$(function(){   $('.fadein img:gt(0)').hide();   setInterval(function(){  $('.fadein :first-child').fadeOut(1000)	 .next('img').fadeIn(1000)	 .end().appendTo('.fadein');},  5000);});function slideSwitch() {   var $active = $('#slideshow IMG.active');   var $next = $active.next();      $next.addClass('active');   $active.removeClass('active');}$(function() {   setInterval( "slideSwitch()", 5000 );});function slideSwitch() {   var $active = $('#slideshow IMG.active');   var $next = $active.next();   $active.addClass('last-active');   $next.css({opacity: 0.0})    .addClass('active')    .animate({opacity: 1.0}, 1000, function() {	    $active.removeClass('active last-active');    });}$(function() {   setInterval( "slideSwitch()", 5000 );});function slideSwitch() {   var $active = $('#slideshow IMG.active');   if ( $active.length == 0 ) $active = $('#slideshow IMG:last');   var $next =  $active.next().length ? $active.next()    : $('#slideshow IMG:first');   $active.addClass('last-active');   $next.css({opacity: 0.0})    .addClass('active')    .animate({opacity: 1.0}, 1000, function() {	    $active.removeClass('active last-active');    });}$(function() {   setInterval( "slideSwitch()", 5000 );});</script>

 

 

 

and W3C says,,,,

 

delimiter "'" invalid: only S separators and TAGC allowed here

…write('<s'+'cript src="http://code.jquery.com/jquery-latest.js"></s'+'cript>');

 

 

 

just int the very beging on this page ...

 

thanks lirys

Share this post


Link to post
Share on other sites

Try escaping the forward slashes with backward slashes.

 

write('<s'+'cript src="http:\/\/code.jquery.com\/jquery-latest.js"><\/s'+'cript>');

Share this post


Link to post
Share on other sites

The validator shouldn't be parsing your Javascript at all and, with the standard HTML validator, won't if you put it behind an HTML comment ...

 

 

<script type="text/javascript"><!-- start js... put javascript code hereend js --></script>

 

 

Since you're validating as XHTML, you could also hide the code in a CDATA block. CDATA, a.k.a. (unparsed) Character Data, specificially tells the validator to take a break for a while.

 

 

<script type="text/javascript"><![CDATA[... put javascript code here]]></script>

 

 

Some older browsers don't understand CDATA, which can create Javascript errors. If you want to support all browsers, you'll have to use Javascript's multi-line comments to hide the CDATA directive. Fortunately, those characters won't throw an error in the XHTML validator. It looks a bit like this:

 

 

<script type="text/javascript">/* <![CDATA[ */... put javascript code here/* ]]> */</script>

 

 

Finally, another alternative, and often the best one, is to put your JS in an external file.

 

 

<script type="text/javascript" src="/path/to/jsfile.js"></script>

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×