js事件之onmousedown和onmouseup

来源:互联网 发布:淘宝店铺背景音乐 编辑:程序博客网 时间:2024/06/07 06:43
<!DOCTYPE html><html><head><script>function mouseDown(){document.getElementById("p1").style.color="red";}function mouseUp(){document.getElementById("p1").style.color="green";}</script></head><body><p id="p1" onmousedown="mouseDown()" onmouseup="mouseUp()">请点击文本!mouseDown() 函数当鼠标按钮在段落上被按下时触发。此函数把文本颜色设置为红色。mouseUp() 函数在鼠标按钮被释放时触发。mouseUp() 函数把文本的颜色设置为绿色。</p></body></html>

0 0
原创粉丝点击