js createElement 加事件
<script>
window.onload = function () {
var input = document.createElement('input');
var button = document.createElement('input');
input.type ='text';
input.id= 'text';
input.value ='1';
button.type='button';
button.value ='逐加';
button.style.width = '40px';
button.style.height = '23px';
document.body.appendChild(input);
document.body.appendChild(button);
button.onclick = function(){
var value = input.value;
input.value = value * 1 + 1;
}
}
</script>
浙公网安备 33010602011771号