Welcome to WebmasterWorld Guest from 107.21.163.40

Forum Moderators: open

Message Too Old, No Replies

Xhtml 1.1 dtd

Disabling JS Function in Opera

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 15, 2002
posts:971
votes: 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...

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 15, 2002
posts:971
votes: 0


When all else fails >> un-install :: re-install;)
8:16 am on May 26, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 4, 2002
posts:5044
votes: 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

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

Senior Member

WebmasterWorld Senior Member tedster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:May 26, 2000
posts:37301
votes: 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)

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

Senior Member

WebmasterWorld Senior Member nick_w is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 4, 2002
posts:5044
votes: 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

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 15, 2002
posts:971
votes: 0


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

Thanks for the link Tedster-

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Mar 15, 2002
posts:971
votes: 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.

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

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Dec 31, 2001
posts:1238
votes: 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!"