<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>页面浮动广告</title>
<style type="text/css">
<!--
#AD {
position:absolute;
left:0px;
top:0px;
z-index:1;
}
#AD A {
font-family:Webdings;
text-decoration:none;
color:#000000;
}
-->
</style>
</head>
<body>
<div id="AD"></div>
<script language="javascript">
<!--
var H = true;
var V = true;
var LinkURL = "javascript:alert('暂无广告!');"; //广告链接到的地址,如果为空,则无链接
var Media = "http://bbs.iecn.net/p_w_upload/Mon_0705/12_12092_b931f6059a96c58.gif" //设置广告图片的URL
var Width = 176; //设置广告图片显示的宽
var Height = 72; //设置广告图片显示的高
var timer;
var nn6 = document.getElementById && !document.all;
window.onload = function()
{
var AD = document.getElementById("AD");
var str = "";
Width = Width == 0 ? 120 : Width;
Height = Height == 0 ? 160 : Height;
str = "<table border="0" cellspacing="0" cellpadding="0"><tr><td style="text-align:right;font-size:20px;"><a href="AD.stop();" onclick="AD.hidden();return false;">r</a></td></tr><tr><td style="border:#000000 1px solid;">";
if(LinkURL != "")
{
str += "<a href="";
str += LinkURL;
str += "" style="font-size:160px;">";
}
str += "<img src="" + Media + "" width="" + Width +"" height="" + Height +"" style="boder:0px;" />";
if(LinkURL != "")
{
str += "</a>";
}
str += "</td></tr></table>";
AD.innerHTML = str;
AD.style.top = "0px";
AD.style.left = "0px";
timer = setInterval("AD.Move();",30);
AD.onmouseover = AD.stop;
AD.onmouseout = function()
{
timer = setInterval("AD.Move();",30);
}
}
AD.Move = function()
{
if(V)
{
AD.style.top = (parseInt(AD.style.top) + 1).toString() + "px";
if(parseInt(AD.style.top) + parseInt(AD.offsetHeight) >= parseInt(document.body.clientHeight))
V = !V;
}
else
{
AD.style.top = (parseInt(AD.style.top) - 1).toString() + "px";
if(parseInt(AD.style.top) <= 0)
V = !V;
}
if(H)
{
AD.style.left = (parseInt(AD.style.left) + 1).toString() + "px";
if(parseInt(AD.style.left) + parseInt(AD.offsetWidth) >= parseInt(document.body.clientWidth))
H = !H;
}
else
{
AD.style.left = (parseInt(AD.style.left) - 1).toString() + "px";
if(parseInt(AD.style.left) <= 0)
H = !H;
}
}
AD.stop = function()
{
clearInterval(timer);
}
AD.hidden = function()
{
AD.stop();
AD.style.display = 'none';
timer = null;
if(!nn6)
event.returnValue = false;
}
//-->
</script>
附件:
[attachment=42]
[attachment=76] (2007-6-1日更新)
[ 此贴被我是学生在2007-06-01 13:22重新编辑 ]