/    Sign up×
Community /Pin to ProfileBookmark

JavaScript Menus

Hello everyone. I need help trying to get my menus to appear when then rolled over regardless of being clicked or not. Here the current code in my menus.js file:

[CODE]
window.onload = init;
var activeMenu = null;

function init() {
var menus = new Array();
var allElms = document.getElementsByTagName(“*”);

for (var i = 0; i < allElms.length; i++) {
if (allElms[i].className ==”menu”) menus.push(allElms[i]);
}

for (var i = 0; i < menus.length; i++) {
menus[i].onclick = changeMenu;
menus[i].onmouseover = moveMenu;
}

document.getElementById(“logo”).onclick = closeOldMenu ;
document.getElementById(“linkList”).onclick = closeOldMenu ;
document.getElementById(“page”).onclick = closeOldMenu ;
document.getElementById(“content”).onclick = closeOldMenu ;
}
function moveMenu() {
//This function moves the pull-down menu from one title to another

if (activeMenu) {
closeOldMenu();

menuID= this.id + “List”;
activeMenu = document.getElementById(menuID);
activeMenu.style.display = “block”;

}
}

function changeMenu() {
//This function changes the pull-down menu displayed in the document

closeOldMenu();

menuID = this.id + “List”;
activeMenu = document.getElementById(menuID);
activeMenu.style.display = “block”;

}
function closeOldMenu() {
if (activeMenu) {
activeMenu.style.display = “none”;
activeMenu = null;
}
}
[/CODE]

What do I need to change here to get my menus to open if an object is rolled over despite not being clicked?

Thank you!

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERFeb 12.2013 — How about providing a bit of the HTML so we don't have to start from scratch with a guess as to what you want to see?
×

Success!

Help @kross2100 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...