Problem with W3C Validation

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
andigwandi
Beginner
Beginner
Posts: 6
Joined: Fri Dec 26, 2008 8:34 am
Location: New Delhi, India
Contact:

Problem with W3C Validation

Post by andigwandi »

Hi

I am using milonic and I am having a problem. The following code is giving error with W3C when I am validating my page:

-------------------------------
<script type="text/javascript">
if(ns4)_d.write("<script src=script/mmenuns4.js type=text/javascript><\/script>");
else _d.write("<script src=script/mmenudom.js type=text/javascript><\/script>");
</script>
-------------------------------

I am using Visual Studio 2008.

Waiting for reply with solution and Thanks for you help in advance.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Problem with W3C Validation

Post by Ruth »

Hi,

I believe you're going to need cdata tags for the call for those files.

Code: Select all

<script language="javascript" type="text/javascript"> 
//<![CDATA[ 
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=mmenuns4.js><\/scr"+"ipt>");       
  else _d.write("<scr"+"ipt language=JavaScript src=mmenudom.js><\/scr"+"ipt>"); 
//]]> 
</script> 
If you do NOT need to support NS4, and there aren't many who use that browser anymore, then you can fix the problem by leaving out the if statement and just calling the mmenudom.js file. Given that NS4 is over 12 years old I believe, unless you have a really specialized audience, i.e. some less technical developed countries may have it, there is really no reason to support it.

Code: Select all

<script type="text/javascript" src="milonic_src.js"></script>	
<script type="text/javascript" src="mmenudom.js"></script>
<script type="text/javascript" src="your_data_file_name.js"></script>	
Ruth
Post Reply