根据Radio值动态显示File

类别:网站制作 点击:0 评论:0 推荐:

代码如下:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script language="JavaScript"> function howmany(){ var fm; fm=document.form1; for(i = 0; i < fm.rd.length; i++){ if(fm.rd[i].checked==true){ for(j=0; j<=i;j++){ document.all.newanew.insertAdjacentHTML("AfterBegin","<input type='file' name='myfile"+i+"'> <br>"); } } fm.rd[i].disabled=true; } } </script> </head> <body> <form name="form1" method="post" action=""> <input type="radio" name="rd" value="1" onClick="howmany()" > 1 <input type="radio" name="rd" value="2" onClick="howmany()" > 2 <input type="radio" name="rd" value="3" onClick="howmany()" > 3 <input type="radio" name="rd" value="4" onClick="howmany()" > 4 <p id="newanew">&nbsp;</p> </form></body> </html>
[Ctrl+A 全选 提示:你可先修改部分代码,再点运行代码]

本文地址:http://com.8s8s.com/it/it30686.htm