代码示例:(标识:dhtm_event_onmousedown)
<html>
<head>
<script type="text/javascript">
function lighton()
{
document.getElementById('myimage').src="/static/demo/images/eg_bulbon.gif"
}
function lightoff()
{
document.getElementById('myimage').src="/static/demo/images/eg_bulboff.gif"
}
</script>
</head>

<body>
<img id="myimage" onmousedown="lighton()" 
onmouseup="lightoff()" 
src="/static/demo/images/eg_bulboff.gif" width="100" 
height="180">
<p>请点击灯泡,把它点亮!</p>
</body>
</html>
运行结果: