大家帮个忙,能在网站首页打开后出现一个漂浮的图片,然后点击图片后能链接到一个新的网址,然后图片消失
这是我原来网上找的,但是点击后图片不消失,而且不关闭的话在别的网页上继续漂浮// JavaScript Document
var imagepath="http://www.baudu.com/pf.gif"   //这里写图片的URL
var imagewidth=300 //这两行写图片的大小
var imageheight=188
var speed=3; 
var imageclick="http://www.sian.com"    //这里写点击图片连接到的地址 
var hideafter=0 
var isie=0; 
if(window.navigator.appName=="Microsoft Internet Explorer"&&window.navigator.appVersion.substring(window.navigator.appVersion.indexOf("MSIE")+5,window.navigator.appVersion.indexOf("MSIE")+8)>=5.5) 

 isie=1; 

else { 
 isie=0; 

if(isie){ 
var preloadit=new Image() 
preloadit.src=imagepath 

function pop() { 
if(isie) { 
x=x+dx;y=y+dy; 
oPopup.show(x, y, imagewidth, imageheight); 
if(x+imagewidth+5>screen.width) dx=-dx; 
if(y+imageheight+5>screen.height) dy=-dy; 
if(x<0) dx=-dx; 
if(y<0) dy=-dy; 
startani=setTimeout("pop();",50); 


function dismisspopup(){ 
clearTimeout(startani) 
oPopup.hide() 

function dowhat(){ 
if (imageclick=="dismiss") 
dismisspopup() 
else 
window.open(imageclick);

if(isie) { 
var x=0,y=0,dx=speed,dy=speed; 
var oPopup = window.createPopup(); 
var oPopupBody = oPopup.document.body; 
oPopupBody.style.cursor="hand" 
oPopupBody.innerHTML = '<IMG SRC="'+preloadit.src+'">'; 
oPopup.document.body.onmouseover=new Function("clearTimeout(startani)") 
oPopup.document.body.onmouseout=pop 
oPopup.document.body.onclick=dowhat 
pop(); 
if (hideafter>0) 
setTimeout("dismisspopup()",hideafter*1000) 

解决方案 »

  1.   

    oPopup在哪定义的?大概需要改到这里面的代码
      

  2.   

    找到漂浮的div的ID,然后设visibility:hide
      

  3.   

    var delta=0.015
    var collection; 
        function floaters() { 
        this.items = []; 
        this.addItem =
    function(id,x,y,content) 
        { 
        document.write('<DIV id='+id+' style="Z-INDEX: 0; POSITION: absolute; width:80px; height:60px;left:'+(typeof(x)=='string'?eval(x):x)+';top:'+(typeof(y)=='string'?eval(y):y)+'">'+content+'</DIV>'); 
        
        var newItem = {}; 
        newItem.object = document.getElementById(id); 
        newItem.x = x; 
        newItem.y = y; 
        
        this.items[this.items.length] = newItem; 
        } 
        this.play =
    function() 
        { 
        collection =
    this.items 
        setInterval('play()',10); 
        } 
        } 
        function play() 
        { 
        if(screen.width<=800) 
        { 
        for(var i=0;i<collection.length;i++) 
        { 
        collection.object.style.display = 'none'; 
        } 
        return; 
        } 
        for(var i=0;i<collection.length;i++) 
        { 
        var followObj = collection.object; 
        var followObj_x = (typeof(collection.x)=='string'?eval(collection.x):collection.x); 
        var followObj_y = (typeof(collection.y)=='string'?eval(collection.y):collection.y); 
        
        if(followObj.offsetLeft!=(document.body.scrollLeft+followObj_x)) { 
        var dx=(document.body.scrollLeft+followObj_x-followObj.offsetLeft)*delta; 
        dx=(dx>0?1:-1)*Math.ceil(Math.abs(dx)); 
        followObj.style.left=followObj.offsetLeft+dx; 
        } 
        
        if(followObj.offsetTop!=(document.body.scrollTop+followObj_y)) { 
        var dy=(document.body.scrollTop+followObj_y-followObj.offsetTop)*delta; 
        dy=(dy>0?1:-1)*Math.ceil(Math.abs(dy)); 
        followObj.style.top=followObj.offsetTop+dy; 
        } 
        followObj.style.display = ''; 
        } 
        } 
        
        var theFloaters =
    new floaters(); 
        theFloaters.addItem('followDiv1','document.body.clientWidth-100',0,'</a><br><a href=广告链接地址 target=_blank><img src=广告图片地址 width=100 height=400 border=0></a>' target=_blank); 
        theFloaters.addItem('followDiv2',0,0,'<br><a href=广告链接地址 target=_blank><img src=广告图片地址 width=100 height=400 border=0></a>' target=_blank); 
        theFloaters.play(); 把上面的代码另存为一个JS文件,然后在想实现此效果的页面用 调用即可!注意修改广告图片地址和连接地址!
      

  4.   

    找找你的代码,里面肯定有个地方定义oPopup,需要改那里面,把那段发出来看看