BleepingComputer.com: Show image on mouse over

Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Show image on mouse over

#1 User is offline   Delta16 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 389
  • Joined: 18-August 08
  • Gender:Male
  • Location:Malta

Posted 18 October 2009 - 07:34 AM

I am using php language. I have an image that when clicked it redirects to another page but, I want when you go on it with the cursor, it wont flip to another image (rollover), it will show another image.

More detail.

I have an image and when on mouse over, a small image with transparent background shows on the other one. I want the main image to be visible too.

I dont want to use the dreamweaver roll over function, cause it adds a lot of useless code. Im making this website "light weight" as possible. Just for satisfaction :thumbsup:


Thanks in advanced

This post has been edited by Delta16: 18 October 2009 - 07:42 AM

Posted Image

#2 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,522
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 18 October 2009 - 10:40 AM

You can't use PHP to do it because PHP runs on the server. The action you are describing takes place on the Client, and therefore needs to be done in a client side language, ie Javascript, Flash, Silverlight. I'm assuming that the code you describe as 'useless code' is actually the javascript handler, which is actually pretty important.

Javascript has a function called "addEventListener" which will add a listener to any element that you specify, for example:

element.addEventListener('mouseover',doSomething );

Where "doSomething" is a function, which for instance can be used to apply a style to an element. The CSS can do any number of things, including displaying an image of some sort.
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#3 User is offline   Delta16 

  • Senior Member
  • PipPipPipPip
  • Find Topics
  • Group: Members
  • Posts: 389
  • Joined: 18-August 08
  • Gender:Male
  • Location:Malta

Posted 18 October 2009 - 01:41 PM

Thanks for the reply.

The useless code which I was talking about is the code that some functions of dreamweaver which puts a long line, where you could get the result you want with a small line.(you know what im saying ?)

Im using CSS too, to position the images and if I put some javascript to get the result which I want, that wouldn't be a problem.
Posted Image

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users