script language="javascript">
function $(ele){return document.getElementById(ele)}
var popIMG={
stimer:null,
etimer:null,
init:function(imgurl,width,height){this.imgurl=imgurl;this.width=width;this.height=height;},
createE:function(){
var obj=document.createElement("div");
obj.id="imgid";
obj.style.width=popIMG.width+"px";
obj.style.height=popIMG.height+"px";
//obj.style.backgroundColor="red";
obj.style.top=0+"px";
obj.style.left=Math.ceil((document.body.clientWidth-popIMG.width)/2)+"px";
obj.style.position="absolute";
obj.style.zIndex=100;
obj.style.overflow="hidden"
var img=document.createElement("img");
img.style.width=popIMG.width+"px";
img.style.height=popIMG.height+"px";
img.src=popIMG.imgurl;
obj.appendChild(img);
document.body.appendChild(obj);
},
start:function(){
popIMG.createE();
popIMG.stimer=setTimeout("popIMG.fade()",3000);
},
fade:function(){
if(popIMG.stimer)clearTimeout(popIMG.stimer);
$("imgid").style.height=(parseInt($("imgid").style.height)-5)+"px";
popIMG.etimer=setTimeout("popIMG.fade()",10);
if(parseInt($("imgid").style.height)<=0){clearTimeout(popIMG.etimer);$("imgid").innerHTML="";document.body.removeChild($("imgid"));}
}
}
popIMG.init("/jscss/demoimg/site.gif",1021,675);
window.onload=popIMG.start;
</script>我需要那张图片上加上超链接 有谁懂的啊? 帮忙下

解决方案 »

  1.   


    script language="javascript">
    function $(ele){return document.getElementById(ele)}
    var popIMG={
    stimer:null,
    etimer:null,
    init:function(imgurl,width,height){this.imgurl=imgurl;this.width=width;this.height=height;},
    createE:function(){
    var obj=document.createElement("div");
    obj.id="imgid";
    obj.style.width=popIMG.width+"px";
    obj.style.height=popIMG.height+"px";
    //obj.style.backgroundColor="red";
    obj.style.top=0+"px";
    obj.style.left=Math.ceil((document.body.clientWidth-popIMG.width)/2)+"px";
    obj.style.position="absolute";
    obj.style.zIndex=100;
    obj.style.overflow="hidden"var aMark=document.createElement("a");//新建一个a标签
    aMark.href="http://www.baidu.com";//加上你的超链接var img=document.createElement("img");
    img.style.width=popIMG.width+"px";
    img.style.height=popIMG.height+"px";
    },img.src=popIMG.imgurl;
    aMark.appendChild(img);//把图片放进a标签里
    obj.appendChild(aMark);//把a标签放进div里面document.body.appendChild(obj);start:function(){
    popIMG.createE();
    popIMG.stimer=setTimeout("popIMG.fade()",3000);
    },
    fade:function(){
    if(popIMG.stimer)clearTimeout(popIMG.stimer);
    $("imgid").style.height=(parseInt($("imgid").style.height)-5)+"px";
    popIMG.etimer=setTimeout("popIMG.fade()",10);
    if(parseInt($("imgid").style.height)<=0){clearTimeout(popIMG.etimer);$("imgid").innerHTML="";document.body.removeChild($("imgid"));}
    }
    }
    popIMG.init("/jscss/demoimg/site.gif",1021,675);
    window.onload=popIMG.start;
    </script>
    obj.style.overflow="hidden"var aMark=document.createElement("a");//新建一个a标签
    aMark.href="http://www.baidu.com";//加上你的超链接

    var img=document.createElement("img");
    img.src=popIMG.imgurl;
    aMark.appendChild(img);//把图片放进a标签里
    obj.appendChild(aMark);//把a标签放进div里面

    document.body.appendChild(obj);
      

  2.   

    直接dreamweaver使用热点功能  这是最简单的。
      

  3.   

    直接用dreamweaver将那个图片添加热点功能 这是最简单的