<script type="text/javascript">
function dump(obj){
var win=window.open('', 'dump', '');
var temp=[];
for(var p in obj){
temp.push(p);
}
temp.sort();
var str="<table border='1'>";
for(var i=0;i<temp.length;i++){
str+="<tr><td>"+temp[i]+"</td><td>"+obj[temp[i]]+"</td></tr>";
}
str+="</table>";
win.document.body.innerHTML=str;
}
function testDump(){
var div=document.getElementById("myDiv");
dump(div);
}
</script>
</head>
<body>
<div id="myDiv">
<p>我来问道无语说,</p>
<p>云在青天水在瓶,</p>
</div>
<button οnclick="testDump()">测试dump</button>
function dump(obj){
var win=window.open('', 'dump', '');
var temp=[];
for(var p in obj){
temp.push(p);
}
temp.sort();
var str="<table border='1'>";
for(var i=0;i<temp.length;i++){
str+="<tr><td>"+temp[i]+"</td><td>"+obj[temp[i]]+"</td></tr>";
}
str+="</table>";
win.document.body.innerHTML=str;
}
function testDump(){
var div=document.getElementById("myDiv");
dump(div);
}
</script>
</head>
<body>
<div id="myDiv">
<p>我来问道无语说,</p>
<p>云在青天水在瓶,</p>
</div>
<button οnclick="testDump()">测试dump</button>