Original code
<HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Generator"content= "HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" /> <title>Mouse move Past zoom color</title> <style>#div1{width:200px;Height:200px;background:Red;} </style> </Head> <Body> <DivID= "Div1"onmouseover= "document.getElementById (' Div1 '). style.height= ' 300px '; document.getElementById (' Div1 '). style.width= ' 300px '; document.getElementById (' Div1 '). style.background= ' green ';onmouseout= "document.getElementById (' Div1 '). style.height= ' 200px '; document.getElementById (' Div1 '). style.width= ' 200px '; document.getElementById (' Div1 '). style.background= ' red '; "></Div> </Body></HTML>
Function
<HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Generator"content= "HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" /> <title>Mouse move Past zoom color</title> <style>#div1{width:200px;Height:200px;background:Red;} </style> <Script> functionTogreen () {document.getElementById ('Div1'). Style.height='300px'; document.getElementById ('Div1'). Style.width='300px'; document.getElementById ('Div1'). Style.background='Green'; } functiontored () {document.getElementById ('Div1'). Style.height='200px'; document.getElementById ('Div1'). Style.width='200px'; document.getElementById ('Div1'). Style.background='Red'; } </Script> </Head> <Body> <DivID= "Div1"onmouseover= "Togreen ()"onmouseout= "tored ()"></Div> </Body></HTML>
Variable name
<HTML> <Head> <MetaCharSet= "Utf-8"> <Metaname= "Generator"content= "HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" /> <title>Mouse move Past zoom color</title> <style>#div1{width:200px;Height:200px;background:Red;} </style> <Script> functionTogreen () {varOdiv=document.getElementById ('Div1'); ODiv.style.height='300px'; ODiv.style.width='300px'; ODiv.style.background='Green'; } functiontored () {varOdiv=document.getElementById ('Div1'); ODiv.style.height='200px'; ODiv.style.width='200px'; ODiv.style.background='Red'; } </Script> </Head> <Body> <DivID= "Div1"onmouseover= "Togreen ()"onmouseout= "tored ()"></Div> </Body></HTML>
Move the mouse over the past to become bigger and greener