[查看演示] 源码如下 ---------------------------------------------------------- <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META NAME="Author" CONTENT="haiwa">
<META NAME="Keywords" CONTENT="51windows.Net">
<title>在flash之上的飘动层-www.51windows.Net</title>
</head>
<body bgcolor="#FFFFFF">
这页没有放flash,飘动层用了Iframe,<A HREF="/myjs/samples/flowimg.htm" target="_blank">下载Iframe页</A>或者在flash上加参数<param name="wmode" value="opaque" >
<div id="oImg" style="position:absolute;top:0;left:200;width:48;height:48;cursor:hand;margin: 0;display:none"><Iframe src="/myjs/samples/flowimg.htm" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" width="48" height="48"></Iframe></div>
<script>
var flagX = 0;
var flagY = 0;
function FlowImg(){
var iOL = oImg.style.pixelLeft;
var iBL = document.body.scrollLeft;
var iOW = oImg.offsetWidth;
var iBW = document.body.clientWidth - 1;
var iOT = oImg.style.pixelTop;
var iBT = document.body.scrollTop;
var iOH = oImg.offsetHeight;
var iBH = document.body.clientHeight;
if( iOL >= iBL && iOL <= ( ( iBL + iBW ) - iOW ) && flagX == 0 ){
oImg.style.pixelLeft += 1;
}
else if( iOL > ( ( iBL + iBW ) - iOW ) && flagX == 0 ){
flagX = 1;
oImg.style.pixelLeft = ( iBL + iBW ) - iOW;
}
else if( iOL < iBL && flagX == 0 ){
oImg.style.pixelLeft = iBL;
}
else if( iOL >= iBL && iOL <= ( ( iBL + iBW ) - iOW ) && flagX == 1 ){
oImg.style.pixelLeft -= 1;
}
else if( iOL > ( ( iBL + iBW ) - iOW ) && flagX == 1 ){
oImg.style.pixelLeft = ( iBL + iBW ) - iOW;
}
else if( iOL < iBL && flagX == 1 ){
oImg.style.pixelLeft = iBL;
flagX = 0;
}
if( iOT >= iBT && iOT <= ( ( iBT + iBH ) - iOH ) && flagY == 0 ){
oImg.style.pixelTop += 1;
}
else if( iOT > ( ( iBT + iBH ) - iOH ) && flagY == 0 ){
flagY = 1;
oImg.style.pixelTop = ( iBT + iBH ) - iOH;
}
else if( iOT < iBT && flagY == 0 ){
oImg.style.pixelTop = iBT;
}
else if( iOT >= iBT && iOT <= ( ( iBT + iBH ) - iOH ) && flagY == 1 ){
oImg.style.pixelTop -= 1;
}
else if( iOT > ( ( iBT + iBH ) - iOH ) && flagY == 1 ){
oImg.style.pixelTop = ( iBT + iBH ) - iOH;
}
else if( iOT < iBT && flagY == 1 ){
oImg.style.pixelTop = iBT;
flagY = 0;
}
}
oInterval = window.setInterval("FlowImg()",10);
</script>
<BODY>
</BODY>
</HTML>
<div style="position: absolute; top: 10; right: 10; width: 148; height: 18;cursor:hand">
<input type="button" name="Button" value="查看源代码" onClick= 'window.location = "view-source:" + window.location.href'></div> |