具体看是用的什么事件,举个简单的例子,例如鼠标单击事件下例: 就是这个名为每次加1按钮的onclick的点击事件调用aclick()函数,使文本框每次都+1
<script>
function aclick()
{
document.getElementById("txt1").value+=1;
}
</script>
<html>
<input type="text" value="1" id="txt1"/>
<input type="button" value="每次加1" onclick="aclick()"/>
</html>
温馨提示:内容为网友见解,仅供参考