js 小贴士一星期合集(2)


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<div >
<div ksjfkls="sdf">
<p>sdf</p>
<p djkfjd="df"></p>
</div>
<div sdfksf=333 >
</div>
</div>
</body>
</html>
<script>
var html = function(){
var d = document,div = d.createElement('div');
return function(id){
var o = d.getElementById(id);
if(o.outerHTML)
return o.outerHTML;
else{
div.innerHTML = ''
var h = '';
div.appendChild(o.cloneNode(true));
return div.innerHTML
}
}
}()
alert(html('aa'))
alert(html('bb'))
</script>

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdszdx.html