实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function myFunction(elmnt,clr)
6
{
7
elmnt.style.color=clr;
8
}
9
</script>
10
</head>
11
<body>
12
13
<p onmousedown="myFunction(this,'red')" onmouseup="myFunction(this,'green')">
14
Click the text to change the color. A function, with parameters, is triggered when the mouse button is pressed down, and again, with other parameters, when the mouse button is released.
15
</p>
16
17
</body>
18
</html>