鼠标移动过去变大变绿
生活随笔
收集整理的這篇文章主要介紹了
鼠标移动过去变大变绿
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
原始代碼
?
<html><head><meta charset="utf-8"><meta name="generator"content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" /><title>鼠標(biāo)移動過去放大變色</title><style>#div1 {width:200px;height:200px;background:red;}</style></head><body><div id="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>?
函數(shù)
<html><head><meta charset="utf-8"><meta name="generator"content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" /><title>鼠標(biāo)移動過去放大變色</title><style>#div1 {width:200px;height:200px;background:red;}</style><script>function toGreen(){document.getElementById('div1').style.height='300px';document.getElementById('div1').style.width='300px';document.getElementById('div1').style.background='green';}function toRed(){document.getElementById('div1').style.height='200px';document.getElementById('div1').style.width='200px';document.getElementById('div1').style.background='red';}</script></head><body><div id="div1" onmouseover="toGreen()"onmouseout="toRed()"></div></body> </html>?
變量名稱
<html><head><meta charset="utf-8"><meta name="generator"content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" /><title>鼠標(biāo)移動過去放大變色</title><style>#div1 {width:200px;height:200px;background:red;}</style><script>function toGreen(){var oDiv=document.getElementById('div1');oDiv.style.height='300px';oDiv.style.width='300px';oDiv.style.background='green';}function toRed(){var oDiv=document.getElementById('div1');oDiv.style.height='200px';oDiv.style.width='200px';oDiv.style.background='red';}</script></head><body><div id="div1" onmouseover="toGreen()"onmouseout="toRed()"></div></body> </html>?
轉(zhuǎn)載于:https://www.cnblogs.com/Yimi/p/5923111.html
總結(jié)
以上是生活随笔為你收集整理的鼠标移动过去变大变绿的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 斐波那契数列的实现(简单递归和动态规划)
- 下一篇: Terminal(终端) 在 OS X