![]() |
|
Change a links's style when mouse is moved over - MSIE4With Microsoft JScript for MSIE4, you can change a links's style when you move the mouse over it. Example: This link turns red when the mouse is over - MSIE4 only. The code is simple:
<a href="new_location" OnMouseOver="this.style.color='red';" OnMouseOut ="this.style.color='blue';"> This link turns red when the mouse is over - MSIE4 only</a> However, Netscape Navigator and Microsoft Internet Explorer 3 will give an error message. You should use this method on MSIE4 specific documents only. Read more in browser specific code. You can avoid the error message in Netscape Navigator (but not MSIE3) by putting this script below in your document before the code above:
<script language=javascript type="text/javascript"> <!-- window.onerror=null // --> </script> Another method is to use the script below. I will apply the style-change to all text-links on the page. Netscape Navigator will not give any errors. However, I do not recommend it if your page have many links. It uses very much cpu power and lags if the user moves the mouse too quickly.
<script language="jscript">
{ document.body.onmouseover=MakeRed;
document.body.onmouseout=MakeNormal;
}
function MakeRed()
{ src = event.toElement;
if (src.tagName == "A")
{ src.oldcol = src.style.color;
src.style.color = 'red';
}
}
function MakeNormal()
{ src=event.fromElement;
if (src.tagName == "A")
src.style.color = src.oldcol;
}
</script>
To specify a custom RGB value, replace 'red' and 'black' with "#rrggbb", where rrggbb is the RGB value. |
welcome |
cartoons |
jokes |
daily jokes |
sitemap |
search |
feedback |
what's new Copyright © 1997-2007 Real Comedy Inc.
|