js问题 createElement或者隐藏几个input 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <div id="div1"></div>var num=document.getElementById("select1").value;//给那个select设id=select1document.getElementById("div1").innerHTML="";for(var i=0;i<num;i++){var ifile=document.createElement("input");ifile.setAttribute("type","file");ifile.setAttribute("value","");ifile.setAttribute("id","FileUp"+num);ifile.setAttribute("class","xgsr1");document.getElementById("div1").appendChild(ifile);document.getElementById("div1").appendChild(document.createElement("br"));} 对了,给那个select加个事件onchange然后调用那段js <script>function a(a){if(a=='1'){document.getElementById('a1').style.display = "";document.getElementById('a2').style.display = "none";document.getElementById('a3').style.display = "none";document.getElementById('a4').style.display = "none";}else if(a =='2'){document.getElementById('a1').style.display = "";document.getElementById('a2').style.display = "";document.getElementById('a3').style.display = "none";document.getElementById('a4').style.display = "none";}else if(a=='3'){document.getElementById('a1').style.display = "";document.getElementById('a2').style.display = "";document.getElementById('a3').style.display = "";document.getElementById('a4').style.display = "none";}else if(a=='4'){document.getElementById('a1').style.display = "";document.getElementById('a2').style.display = "";document.getElementById('a3').style.display = "";document.getElementById('a4').style.display = "";}}</script><select name="select" id="a" onchange="a(this.value)"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option></select><div id="a1">上传图片: <input type="file" /> </div><div id="a2" style="display:none;">上传图片: <input type="file" /> </div><div id="a3" style="display:none;">上传图片: <input type="file" /> </div><div id="a4" style="display:none;">上传图片: <input type="file" /> </div>隐藏的 <script>function a(){var num=document.getElementById("select1").value;//给那个select设id=select1document.getElementById("div1").innerHTML="";for(var i=0;i<num;i++){var ifile=document.createElement("input");ifile.setAttribute("type","file");ifile.setAttribute("value","");ifile.setAttribute("id","FileUp"+num);ifile.setAttribute("class","xgsr1");document.getElementById("div1").appendChild(ifile);document.getElementById("div1").appendChild(document.createElement("br"));}}</script><select id="select1" onchange="a()"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option></select><div id="div1"> </div> 3楼兄弟的 <script>var i =1function a(){ i++ var row = tab.insertRow(tab.rows.length); var col = row.insertCell(0); col.innerHTML = "<input type='text' name='a"+i+"' value='' size='40'>"; }</script><script>function b(){ rtab.deleteRow(tab.rows.length-1); }</script> <input type="button" value="增加" onClick="a()"> <input type="button" value="删除" onClick="b()"> <br> <table id="tab" > <tr> <td>上传图片: <td> </tr> </table>添加表行的纯粹上班无聊 练练手!! 下面这个代码是图片轮换的代码,在ie里好用在火狐不好用 怎么调呢 谢谢了 求教,这个在线客服,怎样才能把他的初始状态改成不隐藏? 如何自动修改Chrome页面中的元素 为什么我鼠标还没离开 图片就消失了 怎么写javascript关闭窗口, 使用firefox js jq新手 如何学 只为了更懒 求教!关于window.showModalDialog的关闭问题 用javascript调用客户端时间问题!!! .net未来生活(科幻小说) 一个关于JS来点亮点击之后连接的问题 getElementById获取不了元素,非常郁闷~~~
var num=document.getElementById("select1").value;//给那个select设id=select1
document.getElementById("div1").innerHTML="";
for(var i=0;i<num;i++)
{
var ifile=document.createElement("input");
ifile.setAttribute("type","file");
ifile.setAttribute("value","");
ifile.setAttribute("id","FileUp"+num);
ifile.setAttribute("class","xgsr1");
document.getElementById("div1").appendChild(ifile);
document.getElementById("div1").appendChild(document.createElement("br"));
}
然后调用那段js
function a(a){
if(a=='1')
{
document.getElementById('a1').style.display = "";
document.getElementById('a2').style.display = "none";
document.getElementById('a3').style.display = "none";
document.getElementById('a4').style.display = "none";
}
else if(a =='2')
{
document.getElementById('a1').style.display = "";
document.getElementById('a2').style.display = "";
document.getElementById('a3').style.display = "none";
document.getElementById('a4').style.display = "none";
}
else if(a=='3')
{
document.getElementById('a1').style.display = "";
document.getElementById('a2').style.display = "";
document.getElementById('a3').style.display = "";
document.getElementById('a4').style.display = "none";
}else if(a=='4')
{
document.getElementById('a1').style.display = "";
document.getElementById('a2').style.display = "";
document.getElementById('a3').style.display = "";
document.getElementById('a4').style.display = "";
}
}
</script>
<select name="select" id="a" onchange="a(this.value)">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<div id="a1">上传图片: <input type="file" /> </div>
<div id="a2" style="display:none;">上传图片: <input type="file" /> </div>
<div id="a3" style="display:none;">上传图片: <input type="file" /> </div>
<div id="a4" style="display:none;">上传图片: <input type="file" /> </div>
隐藏的
function a()
{
var num=document.getElementById("select1").value;//给那个select设id=select1
document.getElementById("div1").innerHTML="";
for(var i=0;i<num;i++)
{
var ifile=document.createElement("input");
ifile.setAttribute("type","file");
ifile.setAttribute("value","");
ifile.setAttribute("id","FileUp"+num);
ifile.setAttribute("class","xgsr1");
document.getElementById("div1").appendChild(ifile);
document.getElementById("div1").appendChild(document.createElement("br"));
}
}
</script>
<select id="select1" onchange="a()">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select><div id="div1"> </div>
3楼兄弟的
<script>
var i =1
function a()
{
i++
var row = tab.insertRow(tab.rows.length);
var col = row.insertCell(0);
col.innerHTML = "<input type='text' name='a"+i+"' value='' size='40'>";
}
</script>
<script>
function b()
{
rtab.deleteRow(tab.rows.length-1);
}
</script> <input type="button" value="增加" onClick="a()">
<input type="button" value="删除" onClick="b()">
<br>
<table id="tab" >
<tr>
<td>上传图片: <td>
</tr>
</table>
添加表行的
纯粹上班无聊 练练手!!