scubadesign Posted June 9, 2009 Share Posted June 9, 2009 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 More sharing options...
chibineku Posted June 9, 2009 Share Posted June 9, 2009 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 More sharing options...
thescientist Posted June 9, 2009 Share Posted June 9, 2009 i think programming code uses /* */ for commentsor try <!-- --> Link to comment Share on other sites More sharing options...
scubadesign Posted June 9, 2009 Author Share Posted June 9, 2009 Thanks guys but neither work as the object still has to display and the java script section of the code is already a link. Link to comment Share on other sites More sharing options...
Ingolme Posted June 9, 2009 Share Posted June 9, 2009 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 More sharing options...
dsonesuk Posted June 10, 2009 Share Posted June 10, 2009 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> Link to comment Share on other sites More sharing options...
Ingolme Posted June 10, 2009 Share Posted June 10, 2009 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 More sharing options...
scubadesign Posted June 10, 2009 Author Share Posted June 10, 2009 Thanks guys i had completely forgotten how to do it, not really needed to in years and all my refferance books are currently in a differant country. :/ Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.