Click to See Complete Forum and Search --> : Onmouseover image change.
no/good/at/this
09-17-2008, 03:40 PM
Hi cant for the life of me remember how to do this, ive got a box i the center of my page that is transparent (but no declared via css), i want the background to change to a diferent background when i wave my pointer over it i.e onmouseover.
<div class="miblock" onmouseover="url('gradient9.jpg')";></div>
Obviously this is wrong but how do i do it???,
Thanks chaps
Coyotelab
09-17-2008, 04:03 PM
since you are dealing with divs you need to declare that in css, other you gotta use image inside that div and java script.
There are two possibilities here;
Inline
<div class="miblock" onmouseover="this.style.backgroundImage='url(gradient9.jpg)'"></div>
or change the class name
<style type="text/css">
.bg2{
background-image:url(gradient9.jpg)
}
</style>
<div class="miblock" onmouseover="this.className='bg2'"></div>
no/good/at/this
09-18-2008, 12:52 PM
Hi Mr J, the first one is the one i was trying to do the 'inline' you've got that spot on,
nice one thanks