1.先把元素从原有的父级上删除
2.添加到新的父级上
<!DOCTYPE html>
<html>
<head>
<title>appendChild 高级运用</title>
</head>
<script type="text/javascript">
window.onload=function(){
var Btn = document.getElementById('btn');
var oul1 = document.getElementById('ul1');
var oul2 =document.getElementById('ul2');
Btn.onclick=function(){
oul2.appendChild(oul1.children[0]);
};
};
</script>
<body>
<style type="text/css">
#ul1{
background: red;
}
#ul2{
background: green;
}
</style>
<ul id="ul1">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
</ul>
<input type="button" id="btn" value="提交"></button>
<ul id="ul2">
</ul>
</body>
</html>