Welcome to WebmasterWorld Guest from 54.196.233.239

Forum Moderators: open

Message Too Old, No Replies

![CDATA[ javascript functions

javascript functions

     

webaster

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

10+ Year Member



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>

MikeFoster

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

10+ Year Member



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?

webaster

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

10+ Year Member



<!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" />

webaster

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

10+ Year Member



errata-list
<meta http-equiv="Content-Type" content="text/htm" charset=iso-8859-1" />

MikeFoster

7:41 pm on Jan 6, 2005 (gmt 0)

10+ Year Member



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 ;)

BjarneDM

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

10+ Year Member



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.

 

Featured Threads

Hot Threads This Week

Hot Threads This Month