creating multiple rollovers

0 pts.
Tags:
JavaScript
Hi, i was wondering if somebody can help me please. I have a rollover button and when it is rollover it changes state - the thing is i want it to change a picture to change states as well - when the button is rollover. Sorry its a little vague. Appreciate any help thanks andy
ASKED: March 1, 2005  8:35 AM
UPDATED: March 1, 2005  9:32 AM

Answer Wiki

Thanks. We'll let you know when a new response is added.

If Inderstand you correctly, you have a button that changes when you rollover it. And you would like the same rollover event to cause a picture to change as well.

If you’re using Javascript you would want something like this:

if (document.images) {
var buttonOn = new Image(); // for the Rollover button
buttonOn.src = “buttonOn .gif”;
var buttonOff = new Image(); // for the base button
buttonOff.src = “buttonOff .gif”;
var ImageOn = new Image(); // for the Rollover button
ImageOn.src = “ImageOn .gif”;
var ImageOff = new Image(); // for the base button
ImageOff.src = “ImageOff .gif”;
}

function RollOn{
if (document.images) {
document.images.button1.src = buttonOn.src;
document.images.Image1.src = ImageOn.src;
}
}

function RollOff{
if (document.images) {
// change the button
document.images.button1.src = buttonOff.src;
// change the other picture ** Make sure your names match
document.images.Image1.src = ImageOff.src;
}
}

You simply add the HTML with the event in the button’s tag
<!–Button tag–>
<IMG NAME=”Button1″ SRC=”buttonOff.gif” onMouseOver=”RollOn()” onMouseOut=”RollOff()”>
<!–Image tag–>
<IMG NAME=”Image1″ SRC=”ImageOff.gif”>

That is, of course, if I understood your question.
Cheers

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following