Hello,
Can someone tell me why I keep getting:
[CODE][object HTMLLIElement][object HTMLLIElement][object HTMLLIElement]
Outputted in Firefox and [object] in IE for this code please?
[CODE]<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” lang=”en-US”>
<head>
<title>Tag Name Locator</title>
<meta http-equiv=”Content-Type”
content=”text/html; charset=utf-8″ />
</head>
<body>
<p>
There are 3 different types of element in this body:
</p>
<ul>
<li>
paragraph
</li>
<li>
unordered list
</li>
<li>
list item
</li>
</ul>
</body>
<script type=”text/javascript”>
var listItems = document.getElementsByTagName(“li”);
for (var i = 0; i < listItems.length; i++)
{
document.write(listItems[i]);
}
</script>
</html>
The output is:
[CODE]There are 3 different types of element in this body:
* paragraph
* unordered list
* list item
[object HTMLLIElement][object HTMLLIElement][object HTMLLIElement]
Shouldn’t it be showing me the content of the li tag?