首页 | 互联网 | IT动态 | 网络设备 | 服务器 | IDC | 安全 | Cisco | Windows | Linux | Java | .Net | Oracle | CIW | 华为 | 专题
IT技术 | 网页设计 | 平面设计 | 电子书下载 | 教学视频 | 方案 | 数字网校 | 直播室 | 虚拟考场 | 面授培训 | 搜索 | 博客 | 沙龙 | 论坛
 Dreamweaver | Flash
 Fireworks  | Frontpage
 HTML/CSS  | Javascript
 Photoshop  | CorelDraw
 AuotoCAD   | Illustrator
 Freehand
 3DMax    | Authorware
 Director   | Maya
 PP点点通 | 迅雷 | BT
 eMule | FlashGet | Nero
 Ghost | Outlook | IE
 Maxthon | Office
 QQ | MSN | 网易泡泡
 Skype | 雅虎通 | 新浪UC

最新文章

您现在的位置: 中国IT实验室 >> 网页设计 >> Javascript教程 >> 文章正文


网页中任意漂浮的广告代码


中国IT实验室收集整理  2007-7-2  佚名  保存本文  推荐给好友  收藏本站


◆ 网页平面多媒体培训、认证考试免费咨询热线:400-700-5807   进入网络咨询平台

网页特效代码:超简单实用的网页中任意漂浮的广告代码

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>网页特效</title>
</head>
<body>
<DIV id=img1 style="Z-INDEX: 100; LEFT: 2px; WIDTH: 59px; POSITION: absolute; TOP: 43px; HEIGHT: 61px;
visibility: visible;"><a href="http://www.dwww.cn" target="_blank"><img src="http://webdesign.chinaitlab.com/UploadFiles_8014/200707/20070702113308946.gif" width="88" height="31" border="0"></a></DIV>
</body>
</html>
<script type="text/javascript">
var xPos = 300;
var yPos = 200;
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;
img1.style.top = yPos;
function changePos()
{
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img1.offsetHeight;
Woffset = img1.offsetWidth;
img1.style.left = xPos + document.body.scrollLeft;
img1.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); }
}

function start()
{
img1.visibility = "visible";
interval = setInterval('changePos()', delay);
}
function pause_resume()
{
if(pause)
{
clearInterval(interval);
pause = false;}
else
{
interval = setInterval('changePos()',delay);
pause = true;
}
}
start();
</script>

【责编:runlz】


 相关文章  推荐文章
dreamweaver制作圆角表格
JavaScript实现变色表格特效
JavaScript实现表格特效
JS特效围绕图片疯狂旋转的花朵
JS特效跟随鼠标的图片
js特效点击会变色哦!!
JavaScript加密解密的实现方法
减轻JavaScript测试和调试负担
未知高度的非表格垂直对齐
JavaScript的9个陷阱及评点
  文章评论