<html>
<head>
<title>test</title>
<link rel="stylesheet" type="text/css" href="./css/test.css" />
</head>
<script>
function testdown() //鼠标按下时
{
//alert("aaa");
document.getElementById('txtptz').value=1;
}
function testup() //鼠标松开时
{
//alert("aaa");
document.getElementById('txtptz').value=2;
}
</script>
<script type="text/javascript">
function mouseDownFun()
{
document.getElementById('div1').innerHTML += 'mouseDown<br/>';
}
function mouseUpFun()
{
document.getElementById('div1').innerHTML += 'mouseUp<br/>';
}
function clickFun()
{
document.getElementById('div1').innerHTML += 'click<br/>';
}
</script>
<body>
<p>test</p>
<input type="test" id="txtptz" onmousedown="testdown();" onmouseup="testup();">
<input id="testptz" type="button" name="reset" value="保存" onmousedown="testdown();" onmouseup="testup();" >
<div id="div1" onmousedown="mouseDownFun();" onmouseup="mouseUpFun();" onclick="clickFun();" style="background:#CCC; border:3px solid #999; width:200px; height:200px; padding:10px"></div>
<input style="margin-top:10px" type="button" onclick="document.getElementById('div1').innerHTML='';" value="清除信息" />
</script>
</div>
</body>
</html>
![](https://pic002.cnblogs.com/images/2012/356637/2012052415342677.jpg)