Click here to Skip to main content
15,561,685 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sweet day for all

my Question is i need to make map in java script language when the mouse curser enter the region path the background color has changed

how can i do this or give me a site can help me

Thanks && Best Regards 4 All
Posted

1 solution

The only good style of defining colors is CSS. Therefore, the only good way to do this in JavaScript is changing or adding the style of the element. And one of the most convenient way of doing this is using jQuery:
http://en.wikipedia.org/wiki/JQuery[^],
http://jquery.com/[^].

You can use the jQuery .addClass, .removeClass or .toggleClass methods:
JavaScript
myElement = $("#myElement"); //find element where the element is marked with id="myElement" in HTML
className = "yellowBackground";

myElement.addClass(className); //make red
myElement.removeClass(className); //restore previous classes and hence CSS properies

//or

myElement.toggleClass(className); //toggle it


Naturally, you would need the correspondent classes in CSS:
CSS
.yellowBackground { background-color: yellow; }


Please see:
http://api.jquery.com/addClass/[^],
http://api.jquery.com/removeClass[^],
http://api.jquery.com/toggleClass/[^].

Learning jQuery is easy and a kind of fun. Start here:
http://docs.jquery.com/Tutorials[^],
http://docs.jquery.com/Tutorials:How_jQuery_Works[^].

—SA
 
Share this answer
 
v6

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900