D1V1网社区 @开门芝麻网 吃饭赚钱 睡觉赚钱 做梦赚钱 http://sns.d1v1.com & http://www.KaiMenZhiMa.com/

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 4482|回复: 2

经典的对联广告代码

[复制链接]
发表于 2011-11-18 18:10:05 | 显示全部楼层 |阅读模式 <
开门芝麻网
连劲智播AI智能自动播实景无人直播(APP免费注册下载)http://kaimenzhima.com/forum.php?mod=viewthread&tid=1
经典的对联广告代码,JS代码实现,很简洁,也是通用的代码,随着滚动条的滚动自动适应,对联大小由CSS控制,这使得代码修改起来更加方便快捷,不懂JS也没有关系。不过本代码有一处遗憾就是没有关闭功能,真想用的可以自己加一个。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>标准对联广告Js代码</title>
<style type="text/css">
<!--
#lovexin12,#lovexin14{
width:90px;
height:230px;
background-color:#ededed;
border:1px solid #ddd;
}
html,body{
height:1203px;
}
#mm{
height:1000px;
}
-->
</style>

<script language="JavaScript" type="text/javascript">
lastScrollY=0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("lovexin12").style.top=parseInt(document.getElementById
("lovexin12").style.top)+percent+"px";
document.getElementById("lovexin14").style.top=parseInt(document.getElementById
("lovexin12").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
}
suspendcode12="<DIV id=\"lovexin12\" style='left:2pxOSITION:absolute;TOP:120px;'>ad1</div>"
suspendcode14="<DIV id=\"lovexin14\" style='right:2pxOSITION:absolute;TOP:120px;'>ad2</div>"
document.write(suspendcode12);
document.write(suspendcode14);
window.setInterval("heartBeat()",1);
</script>
</head>
<body>
<div id="mm"></div>
</body>
</html>



开门芝麻网
部分内容由网友发布或收集于互联网,如有侵权,请联系QQ/微信76815288,第一时间删除!(开门芝麻网 sns.d1v1.com)
回复

使用道具 举报

发表于 2012-5-31 13:16:44 | 显示全部楼层 <
很实用的基于JS+CSS+DIV的网页对联广告代码,自适应网页高度,也就是始终保持在一定调试,这款暂时没有关闭功能。
<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>简洁对联广告代码 www.kmzm.cn</title>
    <script language="JavaScript" type="text/javascript">
    lastScrollY=0;
    function heartBeat(){
    var diffY;
    if (document.documentElement && document.documentElement.scrollTop)
    diffY = document.documentElement.scrollTop;
    else if (document.body)
    diffY = document.body.scrollTop
    else
    {/*Netscape stuff*/}
    //alert(diffY);
    percent=.1*(diffY-lastScrollY);
    if(percent>0)percent=Math.ceil(percent);
    else percent=Math.floor(percent);
    document.getElementById("lovexin12").style.top=parseInt(document.getElementById
    ("lovexin12").style.top)+percent+"px";
    document.getElementById("lovexin14").style.top=parseInt(document.getElementById
    ("lovexin12").style.top)+percent+"px";
    lastScrollY=lastScrollY+percent;
    //alert(lastScrollY);
    }
    suspendcode12="<DIV id=\"lovexin12\" style='left:2pxOSITION:absolute;TOP:120px;'>ad1</div>"
    suspendcode14="<DIV id=\"lovexin14\" style='right:2pxOSITION:absolute;TOP:120px;'>ad2</div>"
    document.write(suspendcode12);
    document.write(suspendcode14);
    window.setInterval("heartBeat()",1);
    </script>
    <style type="text/css">
    <!--
    #lovexin12,#lovexin14{
    width:100px;
    height:230px;
    background-color:yellow;
    border:2px solid red;
    }
    html,body{
    height:800px;
    }
    #mm{
    height:800px;
    }
    -->
    </style>
    </head>
    <body>
    <div id="mm">
    基于JS+CSS+DIV的网页对联广告代码
    </div>
    </body>
    </html>
回复 支持 反对

使用道具 举报

发表于 2013-3-3 16:06:06 | 显示全部楼层 <
不错不错!!












森林舞会    二八杠    金鲨银鲨    跑马游戏    www.leyougame.com   砸金花  砸金花游戏 扎金花游戏下载  www.juleqp.com  www.yiku555.com   扎金花下载  诈金花  炸金花      诈金花  炸金花  炸金花游戏  炸金花游戏下载  诈金花游戏
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

 
在线客服
点击这里给我发消息 点击这里给我发消息 点击这里给我发消息 点击这里给我发消息
售前咨询热线
400-888-xxxx

微信扫一扫,私享最新原创实用干货

QQ|申请友链|Archiver|手机版|小黑屋|D1V1网社区 @开门芝麻网 ( 沪ICP备15050032号-2 )

GMT+8, 2024-5-2 12:30 , Processed in 0.134538 second(s), 33 queries .

Powered by Discuz! X3.4 Designed by www.D1V1.cn

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表