<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<body>
图片1链接:
<script>
var zhs=0;
var $=function(cs){
return document.getElementById(cs)
};
function tjs(){
var sourceNode = $(“tps_”+zhs);
var clonedNode = sourceNode.cloneNode(true); // 克隆节点
zhs=zhs+1;
var vbn=”tps_” + zhs
clonedNode.setAttribute(“id”,vbn );
sourceNode.parentNode.appendChild(clonedNode); // 在父节点插入克隆的节点
}
</script>
上面是我写的只更改父id的代码, 不会写也能修改子元素id值代码,可能我表达不清楚,看下面的代码,就是要做到下面哪种
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<body>
图片1链接:
图片2链接:
图片3链接: