Jump to content

Validator Help (simple Question)


scubadesign
 Share

Recommended Posts

Hi,Im trying to validate some of my pages but i cant remember how to hide code from the validator. I was lazy and made a form using coffee cup form maker and get a load of errors when validating just dew to the script with it. i need to have the form show in the browser but dont know how to hide it from the validator.below is the code i need to hide and display.

<script type="text/javascript" src="swfobject.js"></script><div id="CC4409241">Form Object</div><script type="text/javascript">var so = new SWFObject("myform.swf", "myform.xml", "350", "350", "7,0,0,0", "#ffffff");so.addParam("classid", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000");so.addParam("quality", "high");so.addParam("scale", "noscale");so.addParam("salign", "lt");so.addParam("FlashVars", "xmlfile=myform.xml&w=350&h=350");so.write("CC4409241");</script>

Link to comment
Share on other sites

Link to your script: save it as a .js file, without the opening and closing script tags, and link like this:<script language="javascript" src="wherever_your_file_is.js"></script>

Link to comment
Share on other sites

If your page is XHTML, you have to put the script in <[![CDATA]]> tags:

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

Link to comment
Share on other sites

Originally it was <!--// //--> not <!-- -->I now use the below method, which I got from http://www.giantisland.com/Resources/JavaS..._and_CDATA.aspx

<script type="text/javascript"><!--//--><![CDATA[//><!--JavaScript Code goes here//--><!]]></script>

but this now seems to been updated to

<script type="text/javascript">  /*<![CDATA[*//*---->*/   JavaScript Code goes here  /*--*//*]]>*/  </script>  

Edited by dsonesuk
Link to comment
Share on other sites

I don't put comments around my code, normally. It's only necessary in XHTML, because some of the characters are parseable by XML. I recommend using external scripts when possible.

Link to comment
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
 Share

×
×
  • Create New...