No more nonsense, first on the code for everyone to see
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv=" Content-type " Content= "text/html; Charset=utf-8 "/>
<title> yiyi corner </title>
<body>
<div id=" Win "&G T
<ul id= "Picchange" >
<li>
</li>
<LI&G T
</li>
<li>
</li>
</ul>
</div>
<script type=" Text/javascript ">
var pic = document . getElementById (' Picchange ');
var piclist = pic.getelementsbytagname ("Li");
Alert (piclist[0].firstchild);
</script>
</body>
Above code 1 please respectively in Firefox and IE Run, Firefox appears is [object Text], and IE appears is [object], here IE and Firefox all put Piclist[0]. FirstChild This object as objects, Firefox hint is the text type object, IE no hint finer.
We then run the following section of the code to see, see, the code itself is the same, but Li did not do line indent below.
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Yiyi Garden </title>
<body>
<div id= "Win" >
<ul id= "Picchange" >
<li></li>
<li></li>
<li></li>
</ul>
</div>
<script type= "Text/javascript" >
var pic = document.getElementById (' Picchange ');
var piclist = pic.getelementsbytagname ("Li");
alert (piclist[0].firstchild);
</script>
</body>
Above code 2 please respectively in Firefox and IE Run, Firefox appears is [object Htmlimageelement], and IE appears is [object], here IE and Firefox all put Piclist[0]. FirstChild This object as objects, Firefox hint is htmlimageelement type object, IE no hint finer.
The upper and lower two types of writing just indentation and line change, in IE is recognized as the object, but the different indentation in Firefox but represents a different object, Firefox interpretation of the HTML is really confusing.
This record, I hope that friends see useful, do not have the same problem with me for half a day did not find a way to solve the problem.