/    Sign up×
Community /Pin to ProfileBookmark

multiple variables

I have a working rollover script I want to be able to change two images with an onmouseover function I have one working already.

the image wirks with the script using its name, I tryed using top() and then in the script using e.g top(1), top(2) but I don’t know how to do it properly.
heres the script:

<script>
if (document.images) {
access_over = new Image(); access_over.src = “images-menu/access_info_over.gif”;
business_over = new Image(); business_over.src = “images-menu/business_over.gif”;
top(1)_over = new Image(); top(1)_over.src = “images-menu/ai.gif”;
top(2)_over = new Images(); top(2)_over.scr = “images-menu/b.gif”;
}
function img_activate(imgName,icon,label) {
if (document.images) {
imgOn=eval(imgName + “_over.src”);
document.images[imgName].src = imgOn;
} else {
document.images[imgName].src = icon;
}

window.status=label;
}
function img_deactivate(imgName,icon) {
// return true;
document.images[imgName].src = icon;
window.status=”;
}
</script>

the images go like this:

<img src=”images-menu/transparent.gif” name=”top()”><br>
<a onmouseover=”img_activate(‘access’,”,”); img_activate(‘top(1)’,”,”); return true;” onmouseout=”img_deactivate(‘access’,’images-menu/access_info.gif’); img_deactivate(‘top(1)’,’images-menu/transparent.gif’); return true;” href=”index.php”><img src=”images-menu/access_info.gif” name=”access” border=”0″></a><br>
<a onmouseover=”img_activate(‘business’,”,”); img_activate(‘top(2)’,”,”); return true;” onmouseout=”img_deactivate(‘business’,’images-menu/business.gif’); img_deactivate(‘top(2)’,’images-menu/transparent.gif’); return true;” href=”?pg=business/main.php”><img src=”images-menu/business.gif” name=”business” border=”0″></a><br>

I have the script here:
[URL=http://zealous.net.nz/dans_temp/index.php]http://zealous.net.nz/dans_temp/index.php[/URL]

to post a comment
JavaScript

1 Comments(s)

×

Success!

Help @zealous 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.6,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...