链接类

VML

按钮类

标题类

表单类

表格类

菜单类

窗口类

对象类

滚动条

键盘类

框架类

例子类

模拟类

日期类

色彩类

鼠标类

数学类

图片类

文字类

下拉框

样式类

游戏类

状态栏

资料类

字幕类

其它类

 ·下落的窗口
 ·Div+CSS简单的...
 ·if IE
 ·event.canc...
 ·Do,UnDo,Re...
 ·切换效果
 ·脚本写的IE右键助手
 ·确认对话框
 ·setInterva...
 ·客户端信息检测
您当前位置:好素材首页 -> 网页特效 -> 例子类
查看信息

在flash之上的飘动层
好素材网 www.HaoSc.com 02月22日 11:49

[查看演示]  源码如下
----------------------------------------------------------
<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上加参数&lt;param name=&quot;wmode&quot; value=&quot;opaque&quot; &gt;
<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>


此信息共 1 页 [1]