我知道如何在HTML中创建按钮但是如何创建JavaScript 按下按钮时,它会不断创建多个按钮并继续将它们添加到屏幕上?
<script>
function repeats() {
?
}
</script
<input id ="addsubmit" type="submit" value= "Submit" style = "margin-top: 25px;">
</input>
答案 0 :(得分:1)
在这里 - 请告诉我这是你要求的: - )
<html>
<head>
<script language="javascript">
function repeats() {
document.getElementById('buttons').innerHTML += '<input id ="addsubmit" onclick="repeats()"; type="submit" value= "Submit" style = "margin-top: 25px;">';
}
</script>
</head>
<body>
<input id ="addsubmit" onclick="repeats()"; type="submit" value= "Submit" style = "margin-top: 25px;">
</input>
<div id="buttons">buttons here: </div>
</body>
</html>