我想把漂浮代码放到一个框架页面里面去,应该怎么做?下面是我的代码,首先页面是 a.htm .代码如下:
<html>
<body>
<div id="img" style="position: absolute; left: 311; top: 815;visibility :hidden;" onmouseover="clearInterval(interval)" onmouseout="interval = setInterval('changePos()', delay)" align="right">
<a href="#" target="_blank"><img src="http://www.google.cn/intl/zh-CN/images/logo_cn.gif" onclick="javascript:window.open(this.src);" style="CURSOR: pointer" onload="return imgzoom(this,550)"></a>
<span style="CURSOR:hand;color:red;font-weight:bold" onclick="clearInterval(interval);img.style.visibility = 'hidden'">X</span>
</div>
<script language=javascript>
var xPos = 20;
var yPos = 20;
var step = 1;
var delay = 30;                     
var height = 0;                     
var Hoffset = 0;                    
var Woffset = 0;                     
var yon = 0;                    
var xon = 0;                     
var pause = true;                    
var interval;                    
img.style.top = yPos;                    
function changePos() {                   
width = 860;                    
height = 500 ;                    
Hoffset = img.offsetHeight;                    
Woffset = img.offsetWidth;                   
img.style.left = xPos + 20;                    
img.style.top = yPos + 20;                    
if (yon) {                  
yPos = yPos + step;                    
}               
else {             
yPos = yPos - step;                    
}            
if (yPos < 0) {                  
yon = 1;                    
yPos = 0;                    
}                  
if (yPos >= (height - Hoffset)) {                    
yon = 0;                    
yPos = (height - Hoffset);                     
}                  
if (xon) {                    
xPos = xPos + step;                    
}                 
else {                 
xPos = xPos - step;                   
}                  
if (xPos < 0) {                    
xon = 1;                   
xPos = 0;                   
}         
if (xPos >= (width - Woffset)) {                    
xon = 0;           
xPos = (width - Woffset);                    
}                    
}
function start() {                    
img.style.visibility = "visible";                  
interval = setInterval('changePos()', delay);                    
}              
start();  
</script>
</body>
</html>然后我又写了一个页面,b.htm<html>
<body>
<div >
<iframe width=760 height=0 marginwidth=0 marginheight=0 hspace=0 frameborder=0 scrolling=no src=file:///d:/a.htm>
</iframe>
</div>
</body>
</html>
a.htm 和 b.htm 都保存到d:下面,
直接浏览a.htm页面可以看到漂浮代码,但是浏览b.htm看不到漂浮代码,我要怎么办才能弄好,弄了很久???!!!
高手帮帮忙!!!

解决方案 »

  1.   


    <iframe width=760 height=100 marginwidth=0 marginheight=0 hspace=0 frameborder=0 scrolling=no src="./a.html">
    (1) 你把height设为0了.
    (2) src使用相对路径.
      

  2.   

    我就是要height=0的情况下显示
      

  3.   

    这样肯定没戏, 因为你放到b里的是一个iframe, 位置是固定的, 怎么会动啊..., 另外iframe也是一个页面, 高度设置为0等于他所包含网页的内容就看不到了你把a.htm里面的<body></body>之间的内容考贝到b.html里的</body>前面就行了
      

  4.   

    不明白你为什么要height设为0。
    height为0它就看不到了,
    里面的内容当然也就看不到了。3楼,运行一下楼主的代码你就知道了。
    画面中有一个漂浮的图像。我在b.html中也确认过没有问题.
    除了楼主一定要 height等于0这个要求.
      

  5.   


    晕,我理解是,楼主想让广告漂到a.html的外面也就是b.html页面,可能么?晕~~~