By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,701 Members | 1,955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,701 IT Pros & Developers. It's quick & easy.

document.getElementById(toggle[i]) has no properties

P: 2
I'm getting an error message in FF2.0:

document.getElementById(toggle[i]) has no properties

The goal of the script is, when I hover my mouse over an image, to make one div element visible while making all the others div elements in the array, hidden.

thisDocId is the element to avoid hiding.

This is the script:
[HTML]<script>
function makeHidden(thisDocId) {
var toggle = new Array();
toggle[0] = "about_us";
toggle[1] = "merchants";
toggle[2] = "associations";
toggle[3] = "consumers";
toggle[4] = "newsandevents";

for (i=0;i<toggle.length;i++) {
if (toggle[i] != thisDocId) {
document.getElementById(toggle[i]).visibility="hidden";
}
}
} //end makeHidden function
</script>[/HTML]

This is part of the HTML:
[HTML]<a href="aboutus.html"><img src="images/H0m2.jpg" alt="" name="Image2" align="top" onmouseover='document.getElementById("about_us").v isibility="visible"; makeHidden("about_us");' /></a>[/HTML]

So the idea is to display a <div> menu while toggling the other menus to "hidden";
Jan 19 '08 #1
Share this Question
Share on Google+
1 Reply


P: 2
I figured it out.

The problem code:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('about_us').visibility='visible';
The solution code:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('about_us').style.visibility='visible';
I left out style.

Funny how that took me 45 minutes to see. ARRRG!
Jan 19 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.