It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Problem with onmouseover

Problem with onmouseover

Postby Asmodeux on Wed Apr 30, 2008 4:42 pm

I want to do a simple onmouseover with a div. So I have the following code

<div onmouseover="this.style.background='."'#0F0'".';"...

But it triggers a JS error.

My ultimage goal is to change the background image on mouseover and mouseout.

I dont' want to do this with CSS styles as this doesn't work will IE.
Asmodeux
 
Posts: 0
Joined: Wed Apr 30, 2008 4:39 pm

Postby rangana on Thu May 01, 2008 12:42 am

Your code is erroneous ;)
It should be:
Code: Select all
<div onmouseover="this.style.background='#0f0';">


This example below lets you work with images too as well as your text colors:
Code: Select all
<div style="height:400px;width:300px;" onmouseover="this.style.background='#f00';" onmouseout="this.style.background='url(http://www.sciam.com/media/externalnews/2008-04-23T225027Z_01_NOOTR_RTRIDSP_2_TECH-GOOGLE-ADVERTISING-DC.jpg)';this.style.color='#fff';">
Raymond Angana
</div>


See if it helps ;)
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 2 guests