010308-3 |
Some buttons on web pages will change their colour when the user moves the mouse over the button, even if the user does not press the button. How is this achieved? | |
Answer |
Put into the definition of the button a parameter OnMouseOver='code' where code is some suitable Javascript code. It is suitable to also have a OnMouseOut
script, which will remove the special shading when the mouse leaves
the button. Example (not required): <script language="JavaScript">
function buttonout()
{
document.button.src
= "button.gif";
};
function buttonin()
{
document.button.src
= "buttonov.gif";
}
// end JavaScript.
-->
</script>
<a target=button
href="foo.bar" name="button"
onMouseOut="buttonout()"
onMouseOver="buttonin()">
<img name=button
src="button.gif" border=0></a>
|