homepage Welcome to WebmasterWorld Guest from 54.204.249.184
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
![CDATA[ javascript functions
javascript functions
webaster




msg:1492464
 2:29 pm on Jan 5, 2005 (gmt 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>

 

MikeFoster




msg:1492465
 3:52 pm on Jan 5, 2005 (gmt 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?

webaster




msg:1492466
 1:45 pm on Jan 6, 2005 (gmt 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" />

webaster




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

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

MikeFoster




msg:1492468
 7:41 pm on Jan 6, 2005 (gmt 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 ;)

BjarneDM




msg:1492469
 3:30 am on Jan 12, 2005 (gmt 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.

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.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved