Connecting Tech Pros Worldwide Forums | Help | Site Map

On Mouse over- Change image help!

Newbie
 
Join Date: Aug 2008
Posts: 11
#1: Aug 27 '08
I need a very brief, easy to use code that will let me show ne picture, but change it when the user puts their mouse over the pic.

I have about 20 i need to make, so brief will be appreciated! :)

Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,648
#2: Aug 27 '08

re: On Mouse over- Change image help!


um, this depends a little bit on your html (is it an <img> or a background?) and to what the next picture should be (a specific or random image?)

basicly it works like
Expand|Select|Wrap|Line Numbers
  1. var img = img_recource // use correct DOM here
  2. img.onmousover = function() {
  3.   img.src = new_img_source // add appropriate file name here
  4. }
eWish's Avatar
Moderator
 
Join Date: Jul 2007
Location: Arkansas
Posts: 900
#3: Aug 28 '08

re: On Mouse over- Change image help!


This is more of a JavaScript question it appears. Moving to the JavaScript Forum.

--Kevin
Reply