Go Back   PCMech Forums > Help & Discussion > Internet, Web Applications, & The Cloud

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 11-25-2002, 09:56 AM   #1
Member (4 bit)
 
Join Date: Apr 2002
Posts: 10
Javascript problem - changing picture

I am coding a web page and have a problem with a graphical rollover. I have two images (I'll call them Image1 and Image2). When the mouse goes onto Image1, it changes to Image2, and when the mouse moves off, it reverts back to Image1. I know I have to write something like

onmouseover=MM_SwapImage"Image1"
onmouseout=ImgRestore"Image1"

I want to know how what code to write to do this.
Perton is offline   Reply With Quote
Old 11-25-2002, 11:24 AM   #2
Member (10 bit)
 
Join Date: Jan 2001
Location: Birmingham, UK.
Posts: 553
Send a message via Yahoo to dj4uk
You want a JavaScript rollover I have attached a txt file which gives the code you need - you just need to change the file paths to the images and the image names for it to work. Also has code to preload the rollover image so it is available as soon as someone moves the mouse over the image.

HTH.

DJ
Attached Files
File Type: txt rollover.txt (1.6 KB, 88 views)
dj4uk is offline   Reply With Quote
Old 11-25-2002, 11:25 AM   #3
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
I usually create a funtion in the header of the page like in the attached file.

By using a function, you can call it for multiple images.
Attached Files
File Type: txt js.txt (573 Bytes, 98 views)
__________________

Want to Make $$$$ with your Computer? No Risk! Simply press shift-4 four times in a row
mairving is offline   Reply With Quote
Old 11-25-2002, 11:28 AM   #4
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Now see that is the problem with Dreamweaver. It overcodes.
mairving is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:05 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2