
June 30th, 2009, 02:09 PM
|
|
Contributing User
|
|
Join Date: Nov 2006
Posts: 99
Time spent in forums: 18 h 50 m 19 sec
Reputation Power: 4
|
|
|
GetElementsByTagName('div')
Hello
I have this javascript that gets id of all divs with in particular element, turns all divs off but the one that onmouseover specified.
This works OK in IE Safari and Chrome, but FF won't work.
It gives me error on line with "var anchorTags ="
Any idea why?
Thanks
Code:
<!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-2">
</head>
<body class="thrColFixHdr">
<script language="javascript" type="text/javascript">
function swapClass(id){
var anchorTags = subMenu.getElementsByTagName('div');
for (var i = 0; i < anchorTags.length ; i++){
anchorTags[i].style.visibility = 'hidden';
}
document.getElementById(id).style.visibility = 'visible';
}
</script>
<div id="menu" class="fltrt"><a href="#">SALESPEOPLE</a> <a href="#">VENDORS</a> <a href="#">RESELLERS</a> <a href="../aboutUs.html" onmouseover="javascript:swapClass('subMenu4');">ABOUT US</a></div>
<br class="clearfloat" />
<div id="subMenu" class="subMenu fltrt">
<div id="subMenu4"><a href="#">Management Team</a> <a href="#">Contact Us</a></div>
<div id="subMenu3"><a href="#">111111111111</a> <a href="#">2222222222</a></div>
</div>
<br class="clearfloat" />
</body>
</html>
|