当前位置:K88软件开发文章中心编程语言JavaScriptJS01 → 文章内容

动态生成文本框

减小字体 增大字体 作者:佚名     来源:asp编程网  发布时间:2018-12-30 8:56:41

<
script 
language="
javascript"
>
 

function 
setid() 




str=&
#39
<
br>
&
#39

 

if(!window.form1.upcount.value) 

window.form1.upcount.value=1
 

for(i=1
i<
=window.form1.upcount.value
i++) 

str+=&
#39
文本框&
#39
+i+&
#39
:<
input 
name="
MusicName&
#39
+i+&
#39
"
 
size=20>
<
br>
&
#39

 

window.upid.innerHTML=str+&
#39
<
br>
&
#39

 



<
/script>
 

<
form 
name="
form1"
 
method="
POST"
 
action="
addsong.asp"
>
 

<
li>
需要添加 

<
input 
type="
text"
 
name="
upcount"
 
class="
tx"
 
value="
1"
>
 
个文本框
<
input 
type="
button"
 
name="
Button"
 
class="
bt"
 
onClick="
setid()
"
 
value="
· 
确定 
·"
>
 

<
/li>
 

<
div 
id=upid>
<
/div>



动态生成文本框