_Aerospace_Eng_
04-04-2006, 12:35 PM
Okay I was coding some DOM earlier today. I noticed that IE and FF have a different DOM structure. For example
<!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>
<style type="text/css">
div {
background:#F00;
color:#FFF;
border:1px solid #000;
}
</style>
</head>
<body>
<div onclick="alert(this.childNodes[1].nodeName)">
<input type="radio" />
</div>
</body>
</html>
Clicking on the div in FF will alert INPUT but in IE it will alert #text. Am I doing something wrong or is this just the way IE interprets the document? Anyway to get the same results in IE and FF?
<!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>
<style type="text/css">
div {
background:#F00;
color:#FFF;
border:1px solid #000;
}
</style>
</head>
<body>
<div onclick="alert(this.childNodes[1].nodeName)">
<input type="radio" />
</div>
</body>
</html>
Clicking on the div in FF will alert INPUT but in IE it will alert #text. Am I doing something wrong or is this just the way IE interprets the document? Anyway to get the same results in IE and FF?