README.md

December 4, 2022 ยท View on GitHub

changebutton color on Mouse move using CSS and Javascript

Description

Better Interface

More Info

This code demonstrates how the button change color when the mouse is over it.

Submitted On
ByMarcio Coelho
LevelBeginner
User Rating4.7 (33 globes from 7 users)
CompatibilityASP (Active Server Pages), HTML
CategorySystem Services/ Functions
WorldASP / VbScript
Archive File

Source Code

<html>
<style>
.Over
{
  BACKGROUND-COLOR: #708090;
  COLOR: #ffffff;
  CURSOR: hand
}
.Out
{
  BACKGROUND-COLOR: #c0c0c0;
  COLOR: #000000;
  CURSOR: default
}
</STYLE>
<Body>
<INPUT type="button" tagName="BUTTON" value="Button" id=button1 name=button1>
</body>
<script FOR="document" EVENT="onmouseover" LANGUAGE="javascript">
<!--
document_onmouseover()
//-->
</script>
<script LANGUAGE="javascript" FOR="document" EVENT="onmouseout">
<!--
 document_onmouseout()
//-->
</script>
<script language="Javascript">
<!--
function document_onmouseout()
	{
		if (event.srcElement.tagName == "BUTTON")
			{
			event.srcElement.className = "Out";
			}
	}
	function document_onmouseover()
	{
		if (event.srcElement.tagName == "BUTTON")
			{
			event.srcElement.className = "Over";
			}
 }
	//-->
</script>
</html>