我之前尝试过,但是没有成功。这段代码有问题吗?
<script type ="text/javascript">
function count()
{
var x = 0;
x += 1;
document.getElementById( "counting" ).value = x;
}
</script>
</head>
<body>
<input type ="button" value = "Click" onclick = "count()"/><br><br>
<input id = "counting" type = "text" />
</body>
document.getElementById("counting").value = ++x;
这也是一行不错的代码。 - Alex Bagnolini