homepage Welcome to WebmasterWorld Guest from 50.19.33.5
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe and Support WebmasterWorld
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Xhtml 1.1 dtd
Disabling JS Function in Opera
madcat




msg:1476269
 1:47 am on May 26, 2002 (gmt 0)

For some reason or another Opera 6 no longer sees this external JS function, it happened after updating my code with the XHTML 1.1 DTD. Netscape and IE present no problems. It does read the first JS function in my external script, so I'm thinking I might have something wrong below: (Of course, it all validates)?

<script type="text/javascript">
<!--
changePicture();
//-->
</script>

Thanks as always for ye help...

 

madcat




msg:1476270
 3:14 am on May 26, 2002 (gmt 0)

When all else fails >> un-install :: re-install;)

Nick_W




msg:1476271
 8:16 am on May 26, 2002 (gmt 0)

I never really do any js but I'm almost certain that you need to enclose the function in CDATA

<script>
<![CDATA[
function_here()
]]>
</script>

Nick

tedster




msg:1476272
 9:44 am on May 26, 2002 (gmt 0)

Nick, this was new territory for me, so I did some research - you are exactly right. If you use <script> tags within the XHTML document, the format is exactly as you posted. External scripts called from the HEAD need no special treatment.

Here's the W3C reference on Differences Between HTML 4 and XHTML [w3.org]. Scroll down a bit for Item 4.8 - Script and Style Elements

(edited by: tedster at 1:15 pm (utc) on May 26, 2002)

Nick_W




msg:1476273
 10:22 am on May 26, 2002 (gmt 0)

Me, too. I've never used it but just remember reading the theory a while back. Using that method can, apparently, be a little tricky with old browsers though.

Nick

madcat




msg:1476274
 3:53 pm on May 26, 2002 (gmt 0)

Both IE6 and Opera6 failed to implement this method. Of course, I might of missed something...

Thanks for the link Tedster-

madcat




msg:1476275
 5:37 pm on May 26, 2002 (gmt 0)


<script type="text/javascript">
//<![CDATA[
changePicture();
//]]>
</script>

:: // -- Will keep <![CDATA[]]> from halting your JS.
:: IE6 NN6.2/7 Opera6;)

Doing a search on "PCDATA" and "CDATA" on SEW will present excellent info on the subject.

papabaer




msg:1476276
 7:37 pm on May 26, 2002 (gmt 0)

I've read the W3C reference as well, and since the few javascripts I use are all external, I have not had the need to use the CDATA designation.

Without a doubt there are going to be more than a few "stubbed toes & scraped knuckles" until Web developers migrating to XHTML become familiar with the requirements for embedded javascript. Time for a "HEADS UP!"

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved