J
Jim Michaels
I can't get any "universal" code working that tries to detect whether the
document it's in is xhtml or html.
I found this, which tells me I have a hill to climb with no equipment.
http://javascript.about.com/library/bliebug.htm
I was going to use the document.doctype property if I could, but apparently
that isn't available unless I use strict. (just tried it with Strict, still
doesn't do anything).
here's what I've got. anybody got ideas that work or some pointers? I
don't have any money for books right now, and I wouldn't know which of 100's
of JS books to pick from.
I am using IE6, but I want this to be cross-browser.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
//document.getElementsByTagName('!DOCTYPE') generates an "object", but what
type? element? if so, why won't element properties work?
document.write(document.doctype); //prints nothing
document.write(document.getElementsByTagName('html').getAttribute("xmlns"));
//prints nothing
document.write(document.getElementsByTagName('!DOCTYPE').hasAttribute("-//W3C//DTD
XHTML 1.0 Transitional//EN")); //prints nothing
//if (document.getElementsByName('!DOCTYPE') != null ||
document.getElementsByName('html').getAttribute('xmlns') != null) {
// document.write(document.getElementsByName('html').innerHTML);
//}
</script>
</body>
</html>
I'm really frustrated. I lack info.
Jim Michaels
document it's in is xhtml or html.
I found this, which tells me I have a hill to climb with no equipment.
http://javascript.about.com/library/bliebug.htm
I was going to use the document.doctype property if I could, but apparently
that isn't available unless I use strict. (just tried it with Strict, still
doesn't do anything).
here's what I've got. anybody got ideas that work or some pointers? I
don't have any money for books right now, and I wouldn't know which of 100's
of JS books to pick from.
I am using IE6, but I want this to be cross-browser.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
//document.getElementsByTagName('!DOCTYPE') generates an "object", but what
type? element? if so, why won't element properties work?
document.write(document.doctype); //prints nothing
document.write(document.getElementsByTagName('html').getAttribute("xmlns"));
//prints nothing
document.write(document.getElementsByTagName('!DOCTYPE').hasAttribute("-//W3C//DTD
XHTML 1.0 Transitional//EN")); //prints nothing
//if (document.getElementsByName('!DOCTYPE') != null ||
document.getElementsByName('html').getAttribute('xmlns') != null) {
// document.write(document.getElementsByName('html').innerHTML);
//}
</script>
</body>
</html>
I'm really frustrated. I lack info.
Jim Michaels