/    Sign up×
Community /Pin to ProfileBookmark

Toggle Image Display

Hey guys, I’m trying to toggle several image displays, and it’s just not working. The basic premise is hovering over the logo of a company and then have the banner of the company display above the logos. I have a blank banner for when nothing is hovered, but it’s just not working. Could you guys tell me what I’m doing wrong? Thanks in advance!

[CODE]<div id=”banner_blank” style=”display: block;”><img src=”images/sponsors_blank.jpg” /></div>
<div id=”banner_herrs” style=”display: none;”><img src=”images/sponsors_herrs.jpg”></div>
<div id=”banner_lufthansa” style=”display: none;”><img src=”images/sponsors_lufthansa.jpg” /></div>
<div id=”banner_kaplan” style=”display: none;”><img src=”images/sponsors_kaplan.jpg” /></div>

<br />

<script type=”text/javascript”>
function toggle(var sponsor) {
switch(sponsor) {
case “Blank”:
if(document.getElementById(‘banner_blank’).style.display = ‘none’){ document.getElementById(‘banner_blank’).style.display = ‘block’; }else{ document.getElementById(‘banner_blank’).style.display = ‘none’; }
case “Herrs”:
if(document.getElementById(‘banner_herrs’).style.display = ‘none’){ document.getElementById(‘banner_herrs’).style.display = ‘block’; }else{ document.getElementById(‘banner_herrs’).style.display = ‘none’; }
case “Lufthansa”:
if(document.getElementById(‘banner_lufthansa’).style.display = ‘none’){ document.getElementById(‘banner_lufthansa’).style.display = ‘block’; }else{ document.getElementById(‘banner_lufthansa’).style.display = ‘none’; }
case “Kaplan”:
if(document.getElementById(‘banner_kaplan’).style.display = ‘none’){ document.getElementById(‘banner_kaplan’).style.display = ‘block’; }else{ document.getElementById(‘banner_kaplan’).style.display = ‘none’; }
}
}
</script>

<a href=”javascript:;” onmousedown=”toggle(‘Herrs’);”><img src=”images/sponsors/logo_herrs.jpg” /></a> &nbsp;
<a href=”javascript:;” onmousedown=”toggle(‘Lufthansa’);”><img src=”images/sponsors/logo_lufthansa.jpg” /></a> &nbsp;
<a href=”javascript:;” onmousedown=”toggle(‘Kaplan’);”><img src=”images/sponsors/logo_kaplan.jpg” /></a> &nbsp;
</center>[/CODE]

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@FangSep 15.2010 — Comparison not equality[CODE]if(document.getElementById('banner_blank').style.display [COLOR="Blue"]==[/COLOR] 'none'){[/CODE]
Copy linkTweet thisAlerts:
@chenxilauthorSep 15.2010 — Still not working for some reason...
Copy linkTweet thisAlerts:
@FangSep 15.2010 — [COLOR="Red"]Remove[/COLOR][CODE]function toggle([COLOR="Red"]var[/COLOR] sponsor) {
[/CODE]
×

Success!

Help @chenxil 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.20,
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,
)...