:Programming Skills--C# .net WebPages:CloneNode()

来源:互联网 发布:电脑软件故障是什么 编辑:程序博客网 时间:2024/05/24 05:21

I partipate in  in a new  Web Project at this weenkend , the main task is website maintenance. 

One of the  tasks is about  add the div node that when needed.

The Renderings:



Now we should use the  method :CloneNode() (XML DOM)

<script type="text/javascipt">

// add block

function AddNewBlock() {

    // set the <div id="CurrentBlock">

     var $div =document.getElementById("CurrentBlock");

     var newdiv=$div.cloneNode(true);

      //set the div  id="wantedBlock " whick you want put the cloneNode

      documen.getElementById("WantedBlock").appendChild(newdiv);

}

</script>


Tip:you can clone any node  to any place you wanted by  using  the method cloneNode().   






0 0
原创粉丝点击