Contact Us Forum Rules Search Archive
WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-27-2004, 02:49 AM
hal hal is offline
WebProWorld Member
 

Join Date: Nov 2003
Location: US -- New England
Posts: 97
hal RepRank 0
Default JavaScript in XHTML

Hi Guys,

I haven't found any posts on this; I hope someone can help figure this out. Good XHTML practice indicates that in XHTML a JavaScript statement should have this layout...

<script type="text/javascript">
<!-- description <![CDATA[
yadda yadda yadda
]]> //-->
</script>

Explorer 6 keeps coming up "Error on page." Javascript parsers say that the error is at ]]>. (No problem on Netscape 7 or Firefox.)

And yet, it won't pass W3C validation for XHTML 1.1 without the ]]>.

Do I raise the bridge, lower the river, cut trees for a logjamb, or what?

Thanks,

Hal
__________________
Baughan & Company offers personalized Web site support to small business. http://www.rocksolidsite.com
Reply With Quote
  #2 (permalink)  
Old 07-27-2004, 08:32 AM
paulhiles's Avatar
WebProWorld 1,000+ Club
 

Join Date: Jul 2003
Location: UK
Posts: 2,803
paulhiles RepRank 0
Default Could be the comments...

Hi Hal,

Try this for your Javascript in the head of your page.

Code:
  <script type="text/javascript">
    // <![CDATA[
    if (window != window.top)
    top.location.href=location.href;
    //]]>
I think the < and - signs are incorrectly being interpreted as operators.
The modified version above still validates perfectly well, and doesn't cause an error in IE.
Reply With Quote
  #3 (permalink)  
Old 07-29-2004, 06:23 PM
hal hal is offline
WebProWorld Member
 

Join Date: Nov 2003
Location: US -- New England
Posts: 97
hal RepRank 0
Default

Hello Paul,

I apologize for the delay in getting back to you. (I didn't receive notification that there was a response. <sigh>)

Yes, sir! That appears to be it. Explorer didn't like the commented code. Drop the comment, and you drop the error at the same time.

Figures. Somehow it just... figures! <grin>

Many thanks,

Hal
__________________
Baughan & Company offers personalized Web site support to small business. http://www.rocksolidsite.com
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum
Tags: ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0