常用广告JS代码
一个比较常用的浮动JS代码.
<!--***********开始*************-->
<script type="text/javascript">
var tips; var theTop = 200/*这是默认高度,越大越往下*/; var old = theTop;
function initFloatTips() {
tips = document.getElementById('floatTips');
moveTips();
};
function moveTips() {
var tt=50;
if (window.innerHeight) {
pos = window.pageYOffset
}
else if (document.documentElement && document.documentElement.scrollTop) {
pos = document.documentElement.scrollTop
}
else if (document.body) {
pos = document.body.scrollTop;
}
pos=pos-tips.offsetTop+theTop;
pos=tips.offsetTop+pos/10;
if (pos < theTop) pos = theTop;
if (pos != old) {
tips.style.top = pos+"px";
tt=10;
}
old = pos;
setTimeout(moveTips,tt);
}
</script>
<style type="text/css">
div#floatTips{
position:absolute;
border:solid 1px #777;
padding:3px;
top:250px;
left:500px;
width:300px;
background:#cccccc;
color:white;
}
</style>
</head>
<body onload="initFloatTips()">
<div id="floatTips">
好家伙浮动层</div>
<!--**********结束***************-->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F7F7F7">
<tr>
<td height="2101"> </td>
</tr>
</table>
收藏一个广告代码网站:http://www.jz123.cn/ad.htm
<!--***********开始*************-->
<script type="text/javascript">
var tips; var theTop = 200/*这是默认高度,越大越往下*/; var old = theTop;
function initFloatTips() {
tips = document.getElementById('floatTips');
moveTips();
};
function moveTips() {
var tt=50;
if (window.innerHeight) {
pos = window.pageYOffset
}
else if (document.documentElement && document.documentElement.scrollTop) {
pos = document.documentElement.scrollTop
}
else if (document.body) {
pos = document.body.scrollTop;
}
pos=pos-tips.offsetTop+theTop;
pos=tips.offsetTop+pos/10;
if (pos < theTop) pos = theTop;
if (pos != old) {
tips.style.top = pos+"px";
tt=10;
}
old = pos;
setTimeout(moveTips,tt);
}
</script>
<style type="text/css">
div#floatTips{
position:absolute;
border:solid 1px #777;
padding:3px;
top:250px;
left:500px;
width:300px;
background:#cccccc;
color:white;
}
</style>
</head>
<body onload="initFloatTips()">
<div id="floatTips">
好家伙浮动层</div>
<!--**********结束***************-->
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#F7F7F7">
<tr>
<td height="2101"> </td>
</tr>
</table>
收藏一个广告代码网站:http://www.jz123.cn/ad.htm