Not to mention nonsense. Let's look at the code first.
Copy codeThe Code is as follows:
<! 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 = UTF-8"/>
<Title> Yiyi garden </title>
</Head>
<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>
</Html>
The above code 1 should be run in Firefox and IE respectively. In Firefox, [object Text] appears, while in IE, [object] appears. here, both IE and Firefox use picList [0]. the firstChild object is treated as the object. The Firefox prompt is a Text object, and IE does not prompt more details.
Run the following code to check whether the Code itself is the same, but there is no line feed indentation in li.
Copy codeThe Code is as follows:
<! 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 = UTF-8"/>
<Title> Yiyi garden </title>
</Head>
<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>
</Html>
The above Code 2 should be run in Firefox and IE respectively. In Firefox, [object HTMLImageElement] appears, while in IE, [object] appears. here, both IE and Firefox use picList [0]. the firstChild object is treated as an object. Firefox prompts that it is an object of the HTMLImageElement type, and IE does not prompt more details.
The two statements are only the difference between indentation and line feed. The same object is recognized in IE, but different indentation represents different objects in Firefox, firefox's HTML Parsing is confusing.
Let's record it again. I hope you can see it useful. Don't find a solution because of the same problems as me.