<script>
<!-- 
imgpath="你的图片路径";
imgTrans="你的全透明图片路径";
imgWidth=30;//指定图片宽
imgHeight=30;//指定图片高
//注意:你的两张图片宽和高必须一样
document.write("<div id=img style=\"position: absolute; left: 0; top: 0;\" >");                 
document.write("<img width="+imgWidth+"height="+imgHeight+" id=SampleID src=\""+imgpath+"\" onmouseover=imgstop() onmouseout=imgstart() style=\"filter:blendTrans(duration=0.2)\" >");
document.write("</div>");
var xPos = 20;
var yPos = document.body.clientHeight;
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;
interval=null;function start() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
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);
}
interval=setTimeout("start()",delay);
}function imgstart() {
        SampleID.filters.blendTrans.Apply();
        SampleID.src = imgpath;
        SampleID.filters.blendTrans.Play()
        interval = setTimeout('start()', delay);
}
function imgstop(){
        SampleID.filters.blendTrans.Apply();
        SampleID.src = imgTrans;
        SampleID.filters.blendTrans.Play()
        if(interval!=null) {clearTimeout(interval);interval=null}

}
start();// End -->
</script>

解决方案 »

  1.   

    增加了超级链接
    <script>
    <!-- 
    htmlurl="你的链拉地址";
    imgpath="你的图片路径";
    imgTrans="你的全透明图片路径";
    imgWidth=30;//指定图片宽
    imgHeight=30;//指定图片高
    //注意:你的两张图片宽和高必须一样
    document.write("<div id=img style=\"position: absolute; left: 0; top: 0;\" >");                 
    document.write("<img width="+imgWidth+"height="+imgHeight+" id=SampleID src=\""+imgpath+"\" onmouseover=imgstop() onmouseout=imgstart() onclick=\"location='"+htmlurl+"'\"   style=\"cursor:hand;filter:blendTrans(duration=0.2)\" >");
    document.write("</div>");
    var xPos = 20;
    var yPos = document.body.clientHeight;
    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;
    interval=null;function start() {
    width = document.body.clientWidth;
    height = document.body.clientHeight;
    Hoffset = img.offsetHeight;
    Woffset = img.offsetWidth;
    img.style.left = xPos + document.body.scrollLeft;
    img.style.top = yPos + document.body.scrollTop;
    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);
    }
    interval=setTimeout("start()",delay);
    }function imgstart() {
            SampleID.filters.blendTrans.Apply();
            SampleID.src = imgpath;
            SampleID.filters.blendTrans.Play()
            interval = setTimeout('start()', delay);
    }
    function imgstop(){
            SampleID.filters.blendTrans.Apply();
            SampleID.src = imgTrans;
            SampleID.filters.blendTrans.Play()
            if(interval!=null) {clearTimeout(interval);interval=null}

    }
    start();// End -->
    </script>