<script>
var aa=window.open("动画.htm")
function test(){
alert(aa.document.body.innerHTML)
}
</script>
<input type=button onclick="test()" value="只能得到<body>  </body>之间的代码。得到新窗口代码!">动画.htm
====================<script>
var tmId;
function moveit(){
if((parseInt(document.all.mxh.style.left))>300)
{
document.all.mxh.style.left="0";
document.all.mxh.style.top="0";
}
else
{
document.all.mxh.style.left=(parseInt(document.all.mxh.style.left)+3).toString()+"px"
document.all.mxh.style.top=(parseInt(document.all.mxh.style.top)+3).toString()+"px"
}
tmId=setTimeout('moveit()',20)
}</script>
<body onload="moveit()" bgcolor="#0099ff">
<div id=mxh style="position:absolute;left:0px;top:0px"><a href="http://lucky.myrice.com" target="_blank"><img src="http://lucky.myrice.com/javabk1.jpg" onmouseover="window.clearTimeout(tmId)" onmouseout="window.setTimeout('moveit()',20)" border=0></a></div>

解决方案 »

  1.   

    <body>标记也可以得到!
    <script>
    var aa=window.open("动画.htm")
    function test(){
    alert(aa.document.body.outerHTML)
    }
    </script>
    <input type=button onclick="test()" value="只能得到<body>  </body>(含body标记)之间的代码。得到新窗口代码!">动画.htm
    ====================<script>
    var tmId;
    function moveit(){
    if((parseInt(document.all.mxh.style.left))>300)
    {
    document.all.mxh.style.left="0";
    document.all.mxh.style.top="0";
    }
    else
    {
    document.all.mxh.style.left=(parseInt(document.all.mxh.style.left)+3).toString()+"px"
    document.all.mxh.style.top=(parseInt(document.all.mxh.style.top)+3).toString()+"px"
    }
    tmId=setTimeout('moveit()',20)
    }</script>
    <body onload="moveit()" bgcolor="#0099ff">
    <div id=mxh style="position:absolute;left:0px;top:0px"><a href="http://lucky.myrice.com" target="_blank"><img src="http://lucky.myrice.com/javabk1.jpg" onmouseover="window.clearTimeout(tmId)" onmouseout="window.setTimeout('moveit()',20)" border=0></a></div>
      

  2.   

    好啦!!完整的解决方案来啦!!!
    =========================
    <script>
    var aa=window.open("动画.htm")
    function test(){
    alert(aa.document.documentElement.outerHTML)
    }
    </script>
    <input type=button onclick="test()" value="只能得到<body>  </body>之间的代码。得到新窗口代码!">
    动画.htm
    ==========<script>
    var tmId;
    function moveit(){
    if((parseInt(document.all.mxh.style.left))>300)
    {
    document.all.mxh.style.left="0";
    document.all.mxh.style.top="0";
    }
    else
    {
    document.all.mxh.style.left=(parseInt(document.all.mxh.style.left)+3).toString()+"px"
    document.all.mxh.style.top=(parseInt(document.all.mxh.style.top)+3).toString()+"px"
    }
    tmId=setTimeout('moveit()',20)
    }</script>
    <body onload="moveit()" bgcolor="#0099ff">
    <div id=mxh style="position:absolute;left:0px;top:0px"><a href="http://lucky.myrice.com" target="_blank"><img src="http://lucky.myrice.com/javabk1.jpg" onmouseover="window.clearTimeout(tmId)" onmouseout="window.setTimeout('moveit()',20)" border=0></a></div>