HTML按钮功能

时间:2012-10-22 00:29:41

标签: javascript html function button repeat

我知道如何在HTML中创建按钮但是如何创建JavaScript 按下按钮时,它会不断创建多个按钮并继续将它们添加到屏幕上?

   <script>
    function repeats() {
            ?
    }
   </script
   <input id ="addsubmit"  type="submit" value= "Submit" style = "margin-top: 25px;">
   </input>

1 个答案:

答案 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>