Welcome to WebmasterWorld Guest from 107.21.16.70

Forum Moderators: open

Message Too Old, No Replies

![CDATA[ javascript functions

javascript functions

     
2:29 pm on Jan 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 4, 2005
posts:178
votes: 0


when using xhtml doctype or other is there a need for including this:

![CDATA[

your javascript here

]]

in the head-tag:

<script type="text/javascript">
// <![CDATA[
function preloadimages() {
var imgdir = "/images/";
box1 = new Image;
box1.src = imgdir+"bullet-bluebox.gif";
box2 = new Image;
box2.src = imgdir+"bullet-palebluebox.gif";
box3 = new Image;
box3.src = imgdir+"bullet-palecheck.gif";
}
// ]]>
</script>

is this good too

<script type="text/javascript">
<!--
function preloadimages() {
var imgdir = "/images/";
box1 = new Image;
box1.src = imgdir+"bullet-bluebox.gif";
box2 = new Image;
box2.src = imgdir+"bullet-palebluebox.gif";
box3 = new Image;
box3.src = imgdir+"bullet-palecheck.gif";
}
//-->
</script>

3:52 pm on Jan 5, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:July 20, 2001
posts:137
votes: 0


This [hixie.ch] is worth a read. Scroll down to the "SPECIFIC PROBLEMS" heading.
Also take a look at the XHTML 1.0 HTML Compatibility Guidelines [w3.org].

Are you using XHTML 1.0 or 1.1?
What MIME type do your documents get served as?

1:45 pm on Jan 6, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 4, 2005
posts:178
votes: 0


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<meta http-equiv="Content-Script-Type" content="text/javascript" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

1:47 pm on Jan 6, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:Jan 4, 2005
posts:178
votes: 0


errata-list
<meta http-equiv="Content-Type" content="text/htm" charset=iso-8859-1" />
7:41 pm on Jan 6, 2005 (gmt 0)

Junior Member

10+ Year Member

joined:July 20, 2001
posts:137
votes: 0


Since you're serving your pages as 'text/html', then the links I provided above should be relevant.

I think the easy solution to this question is simply to always use external js files with xhtml pages - altho I know that doesn't directly answer your question ;)

3:30 am on Jan 12, 2005 (gmt 0)

Full Member

10+ Year Member

joined:Dec 22, 2002
posts:334
votes: 0


the application/xhtml+xml v text/html when applied to xhtml coding has been discussed in depth in several threads both here and elsewhere:

[osnews.com...]
[webmasterworld.com...]

the above links ought to be some of the most recent discussions, and should address all of your issues - at least if you also follow the link to hixie.

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members