//显示数字的ID为 num
//加号添加onclick事件 onclick=addNum()
<script>
function subNum(){
document.getElementById("num").value=document.getElementById("num").value-1
}
function addNum(){
document.getElementById("num").value=document.getElementById("num").value+1
}
</script>
<button type="button" style="width:30pxheight:22px" onclick="jia(0)">-</button><input type="text" name="a" id="a" value="1" size="5"/>
<button type="button" style="width:30pxheight:22px" onclick="jia(1)">+</button>
日期:<input type="text" name="ri" id="ri" size="10"/>
<script>
function $(v){return document.getElementById(v)}
function jia(x){
var y=parseInt($("a").value)
if (x==0){y=y-1}else{y=y+1}
$("a").value=y
}
var d = new Date()
var str = d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()
$("ri").value=str
</script>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)