如何实现一个按钮,将左边input的数加1?
发布: 2010-3-09 06:17 | 作者: 网友 | 来源: 网络 | 查看: 1次
<strong>已入会场人数 </strong>:
<input type=text name=pcount2 value="0"/>
我想在右边加一个按钮或什么的,反正能实现 左边的 value 在原来的基础加1就行了!
如何实现呢?
谢谢高手 ---------reply--------------
- HTML code
-
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=utf-8">
<META http-equiv="Content-Style-Type" content="text/css">
<script language="javascript">
function
addInput(){
var
div=document.getElementById("inputDiv");
div.value=parseInt(div.value)+1;
}
window.onload=function(){
}
</script>
</head>
<body>
<div><input type="text" id="inputDiv" value="1" /><input
type="button">="addInput()" value="+" ></div>
<div></div>
</body>
</html>
---------reply--------------
- HTML code
- <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> </head> <body> <strong>已入会场人数 </strong>: <input type="text" value="0" readonly><button type="button">="this.previousSibling.value=parseInt(this.previousSibling.value)+1">Click Me</button> </body> </html> ---------reply-------------- ---------reply-------------- 谢谢!!!
