日期:2014-05-16 浏览次数:20428 次
<!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">
<body>
<div id="tip1" style="width:100px;height:100px;border:1px solid red">
<div id="sp" style="height:50px;height:50px;border:1px solid blue"></div>
</div>
<div id="tip2" style="width:100px;height:100px;border:1px solid green"></div>
<script>
document.getElementById("tip1").onclick=function(){
document.getElementById("tip2").innerHTML=document.getElementById("tip1").innerHTML;
document.getElementById("tip1").innerHTML='';
}
document.getElementById("sp").onclick=function(e){
var e=e||window.event;
if (!document.all)
e.stopPropagation()
else
window.event.cancelBubble=true
alert(111);
}
</script>
</body>
</html>
<head>
<title></title>
</head>
<body>
<div id="tip1" style="width:100px;height:100px;border:1px solid red">
<div id="sp" style="height:50px;height:50px;border:1px solid blue"></div>
</div>
<div id="tip2" style="width:100px;height:100px;border:1px solid green"></div>
<script type="text/javascript">
var sp = document.getElementById("sp");
var tip1 = document.getElementById("tip1");
var tip2 = document.getElementById("tip2");
sp.onclick = function (e) {
var e = e || window.event;
if (!document.all) e.stopPropagation()
else window.event.cancelBubble = true
alert(111);
};
tip1.onclick = function () {
this.removeChild(sp);
tip2.appendChild(sp);
};
</script>
</body>