PDA

View Full Version : I need a little code!


olivier78
04-14-2003, 04:13 AM
Hi there,

I was given some time ago a simple (Microsoft IE?) code that allowed an image to be loaded in black and white, and when a user roll over it, the image came gradually in colour... DOes anyone knows what I am refering to?

Also, I am aware of a cross browser compatibility, and if possible, I would rather get a code that would work in as many browser as possible... Thank you!

Olivier

"A journey of a thousand miles begins with a single step."

Mhtml
04-14-2003, 04:40 AM
Hi,

Please make sure to give your threads an appropriate title, refer to the posting guidelines (postguide.htm) before your post again![/*]
What you require can be easily achieved using CSS and some Javascript! Please visit www.w3schools.com to learn more about each of them[/*]

This is what you required I think:
<html>
<head>
<style>
img
{
filter:gray()
}
</style>
<script type="text/javascript">
function color()
{
myImage.style.filter=false
}
function gray()
{
myImage.style.filter="gray()"
}
</script>
</head>
<body>
<b>Mouse over the image</b><br />
<img id="myImage" src="landscape.jpg" onmouseover="color()" onmouseout="gray()" width="160" height="120">
</body>
</html>