Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.
Why do I get more than 3 results for tags matching 'a'?
<!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>
<title>Website</title>
</head>
<body>
<h1>Hello World</h1>
<p>
<a>Hello</a>
<a>World</a>
<a>Testing</a>
</p>
<script type="text/javascript">
var items = document.body.getElementsByTagName("a");
for(var ii in items) {
alert((ii) +': '+ items[ii].innerHTML);
}
</script>
</body>
</html>
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26:
Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.
Posted on 2011-05-09 at 05:00:38ID: 36812467
All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.