/    Sign up×
Community /Pin to ProfileBookmark

redeclaring getElementById

Hi all

I’m building a css driven drop down menu hence the top function ( [URL=http://www.alistapart.com/articles/dropdowns/]suckerfish[/URL] ). This bit of script is to look after internet explorer. Now i want to be clever and have some hidden div layers for log ins and shopping carts but i.e. throws its dummy because of redeclaring the getElementById i think.

Any ideas?!

[code]
//drop down list system
startList = function() {
if (document.all&&document.getElementById) {
navRoot = document.getElementById(“nav”);
for (i=0; i<navRoot.childNodes.length; i++) {
node = navRoot.childNodes[i];
if (node.nodeName==”LI”) {
node.onmouseover=function() {
this.className+=” over”;
}
node.onmouseout=function() {
this.className=this.className.replace(” over”, “”);
}
}
}
}
}
window.onload=startList;

// FLOATING DIV STUFF
function hidediv() {
if (document.all&&document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(‘hideshow’).style.visibility = ‘hidden’;
}
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = ‘hidden’;
}
else { // IE 4
document.all.hideshow.style.visibility = ‘hidden’;
}
}
}

function showdiv() {
if (document.all&&document.getElementById) { // DOM3 = IE5, NS6
document.getElementById(‘hideshow’).style.visibility = ‘visible’;
}
else {
if (document.layers) { // Netscape 4
document.hideshow.visibility = ‘visible’;
}
else { // IE 4
document.all.hideshow.style.visibility = ‘visible’;
}
}
}
[/code]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@7studDec 11.2004 — "Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"
Copy linkTweet thisAlerts:
@curbauthorDec 11.2004 — you what?!

But when perspiciatis whence all that to be born error he is pleasant accusantium doloremque laudantium totam rem open eaque herself which counting from for that contriver truthfulness and as if architecto happiness life things dictated are explanation. No one in fact herself pleasant because sensual delight he is contempt either odit either fugitive , but because consequuntur magni pain these quae system pleasant to follow to be ignorant. Worthless forward anyone is , quae pain itself because pain he is amet consectetur , to come up to skirmish , but because not at no time her moderate transitory cut when to sink and pain magnam some to seek pleasant. When in fact to in the least degree grace , anyone our work at ullam fleshly to raise up laboriously , if not when someone out of this to make fit consequatur? Anyone but or he to swear an oath reprehenderit quae upon this pleasant skirmish to be how nothing annoyance consequatur , or that quae pain he to flee from sensual delight nulla to pay?[/QUOTE]

This is a JavaScript forum isn't it?!
×

Success!

Help @curb 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.19,
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,
)...