Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 02-03-2007, 08:26 PM   #1
Mondsreitersmann
 
Nuclear Krusader's Avatar
 
Join Date: Jul 1999
Location: Skingrad
Posts: 8,781
Change images on mouseover

Howdy,

Anyone knows how can I make a picture appear in place of another when the mouse is passed over and revert to the original one when the mouse pointer is moved off the pic?

TIA
__________________
Darum still, füg' ich mich, wie Gott es will. Nun, so will ich wacker streiten, und sollt' ich den Tod erleiden, stirbt ein braver Reitersmann.
Nuclear Krusader is offline   Reply With Quote
Old 02-04-2007, 02:57 PM   #2
Member (7 bit)
 
Paintbait's Avatar
 
Join Date: Nov 2004
Location: Western Michigan, USA
Posts: 112
Send a message via AIM to Paintbait Send a message via MSN to Paintbait Send a message via Skype™ to Paintbait
Pseudo-classes should do the trick.

Eg. :hover, :active

Here is a good tutorial on doing it in pure CSS, it works pretty well if you implement it right.

I hope that helps.

PS. Nice TES3 Reference
__________________
Detroit Tigers, The Roar Restored.
PC Mechanic Author Profile
Paintbait is offline   Reply With Quote
Old 02-04-2007, 06:23 PM   #3
Mondsreitersmann
 
Nuclear Krusader's Avatar
 
Join Date: Jul 1999
Location: Skingrad
Posts: 8,781
Thanks for replying. I'm gonna try that out and see how it works.
Nuclear Krusader is offline   Reply With Quote
Old 02-05-2007, 05:40 AM   #4
It can never be too quiet
 
Stryker's Avatar
 
Join Date: May 2004
Location: Burlington, Ontario
Posts: 1,090
Hiya Nuke,
Another way is to use a weee bit of JavaScript. It may be a little more reliable over different browsers. I've had a bit of trouble using Pseudo-classes in the past, but that's not to say they are bad. Here's another idea:

This goes in your (HEAD) section:
PHP Code:
<script language="JavaScript">
function 
changeImage(id,img)
{
    
document.getElementById(id).src img;
}
</script> 
And then you can reference it whever you want in your (BODY) section with different IDs and images:
PHP Code:
<img src="Image01.gif" id="Image01" onMouseOver="changeImage(this.id,'Image02.gif');" onMouseOut="changeImage(this.id,'Image01.gif');" />

<
img src="Image03.gif" id="Image02" onMouseOver="changeImage(this.id,'Image04.gif');" onMouseOut="changeImage(this.id,'Image03.gif');" />

<
img src="Image05.gif" id="Image03" onMouseOver="changeImage(this.id,'Image06.gif');" onMouseOut="changeImage(this.id,'Image05.gif');" /> 
If you need further explination, feel free to ask. Hope this helps too.
Stryker
__________________
Athlon XP 2800+ • Asus A7N8X (nVidia Nforce2) • Radeon 9600 Pro 256MB • 2x512MB KVR DDR PC3200 Dual Channel • 120GB Seagate 7200RPM 8MB • 160GB WD 7200RPM 8MB • Liteon DVD±RW DL • AOpen DVD±RW DL • Vantec Ion2 350W PSUSend me your picture for the Member Photo Gallery

Last edited by Stryker; 02-05-2007 at 05:55 AM.
Stryker is offline   Reply With Quote
Old 02-05-2007, 12:36 PM   #5
Member (7 bit)
 
Paintbait's Avatar
 
Join Date: Nov 2004
Location: Western Michigan, USA
Posts: 112
Send a message via AIM to Paintbait Send a message via MSN to Paintbait Send a message via Skype™ to Paintbait
I like that, pseudo classes have been my enemy of happiness in the past.
Paintbait is offline   Reply With Quote
Old 02-11-2007, 12:33 AM   #6
Mondsreitersmann
 
Nuclear Krusader's Avatar
 
Join Date: Jul 1999
Location: Skingrad
Posts: 8,781
I tried the first method and it was working fine 'cept for the mouse pointer changing to the hand, and I couldn't figure out how to prevent that.

Then I came back to this thread and found Stryker's method. Worked like a charm!

Thanks a bunch, to both of you.
Nuclear Krusader is offline   Reply With Quote
Old 02-12-2007, 05:30 AM   #7
It can never be too quiet
 
Stryker's Avatar
 
Join Date: May 2004
Location: Burlington, Ontario
Posts: 1,090
No prob Nuke!
Just for reference, to change the mouse pointer to whatever you want using CSS.
http://www.w3schools.com/css/pr_class_cursor.asp

Glad it's working.
Stryker
Stryker 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Software Multiplier change. The_YongGrand Computer Hardware 1 11-30-2006 10:30 AM
how to change mouse dpi on my mx510? mandugi23 Computer Hardware 0 10-14-2006 11:27 PM
How to change a user name in the Windows System Folder darla Windows Legacy Support (XP and earlier) 1 09-15-2005 06:03 PM
Heres some Window Secrets Citron Windows Tips, Tricks, and Tweaks 22 01-12-2003 07:07 AM
Internet Explorer won't display local images oryx Internet, Web Applications, & The Cloud 8 11-19-2001 08:28 AM


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