<html>
    <head>
        <script type="text/javascript">
        function createInput(){    
            var resultSpan = document.getElementById("idAttach");           
            var attachNo = parseInt(document.frm.attachNo.value);
            if (!isNaN(attachNo)) {
                for (var i = 1; i <= attachNo; i++) {               
                    var inputTag = document.createElement("INPUT");           
                    var brTag = document.createElement("BR");           
                    inputTag.type = "file";
                    inputTag.name = "input3_" + i;
                    resultSpan.appendChild(inputTag);
                    resultSpan.appendChild(brTag);               
                }
            }
        }
        function createInput2() {    
            for (var i = 1; i <= parseInt(document.frm.attachNo.value); i++) {
                idAttach.innerHTML += "<input type=\"file\" name=\"input3_" + i + "\"><br>";
            }
        }        </script>
        <title></title>
    </head>
    <body>
        <form id="frm" name="frm">
            이름:<input type="text" name="input1"><br>
            주소:<input type="text" name="input2"><br>
            첨부:<input type="text" name="attachNo" value="2" size="2"><input type="button" value="Create" onclick="createInput()"><br>           
            <span id="idAttach"></span>
        </form>       
    </body>
</html>

 

+ Recent posts