JS动态增加页面上的控件实例
<input type="button" value="继续添加" onclick="append();"/ >
<div id="div1" >
<input type="file" name="file1" >
<div >
<script language="javascript" >
var index=1;
function append()
{
var div =document.getElementById("div1");
var file=document.createElement("input");
file.setAttribute("type","file");
index++;
var name=file+index;
file.setAttribute("name",name);
div.appendChild(file);
var br=document.createElement("br");//换行
div.appendChild(br);
}
</script >
<div id="div1" >
<input type="file" name="file1" >
<div >
<script language="javascript" >
var index=1;
function append()
{
var div =document.getElementById("div1");
var file=document.createElement("input");
file.setAttribute("type","file");
index++;
var name=file+index;
file.setAttribute("name",name);
div.appendChild(file);
var br=document.createElement("br");//换行
div.appendChild(br);
}
</script >
posted on 2007-10-12 15:30 lbq1221119 阅读(1018) 评论(0) 编辑 收藏 举报