复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>add_line</title>
<script language="javascript" type="text/jscript"><!--

function add_input_file(tbfile, index)
{
file_name = "file" + index;
var tr_file = document.createElement("tr");
var td_file = document.createElement("td");
var input_file = document.createElement("input")
input_file.setAttribute("type","file")
input_file.setAttribute("size","50")
input_file.setAttribute("name",file_name)

td_file.appendChild(input_file)
tr_file.appendChild(td_file)
tbfile.appendChild(tr_file)
}
function add_one_file()
{
var tb_file = document.getElementById("upload_file");
var count_file = document.getElementById("upload_file").childNodes.length;
//window.alert(steps_nums);
add_input_file(tb_file, count_file);
}

// --></script>
</head>
<body>
<div style="text-align: center" style="text-align: center">
<form>
<table width="90%">
<tr>
<td>
<BR />
<BR />
<h5>配置文件上传</h5>
</td>
</tr>
<tr>
<td>
<table id="upload_file">
<tr class="tabletext">
<td><input type="file" name="job" size="50"/></td>
</tr>
<tr class="tabletext">
<td><input type="file" name='file2' size="50"/></td>
</tr>
<tr class="tabletext">
<td><input type="file" name='file3'size="50"/></td>
</tr>
</table>
</td>
</tr>

<tr>
<td align="left">
<input type="button" value="新增一行" onclick="add_one_file()"/>
<input type="submit" value="保 存"/>
<input name="ciname" value="{{ciname}}"/>
<input name="type" value="default"/>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>

把所有代码拷下另存为一个html文件,在浏览器中打开,点击“新增一行”按钮就可以,以下是对js函数的解释

document.createElement 创建一种页面标签
setAttribute:为某一标签设置属性
appendChild:在另一标签中添加一子标签
标签:
js,动态添加,标签

免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。