一个很好用的平滑的js对联广告代码2008-11-06 10:38不晓得为什么很多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“>这个声明之后就不能用了 真是的 学要不求甚解

http://www.leadbbs.com/MINI/Default.asp?230-2691647-0-0-0-0-0-a-.htm

没事做写了一个对联广告类,符合W3C标准,献丑啦。 云端o枫o0,2007-11-10 15:16:06

HTML代码:
LEADBBS CODE

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “[URL=http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]“>
<html xmlns=”[URL=http://www.w3.org/1999/xhtml]http://www.w3.org/1999/xhtml[/URL]“>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<title>云端o枫o0的对联广告类</title>
<script type=”text/javascript” src=”Js/Maple_Couplet.Js”></script>
<script type=”text/javascript”>
window.onload = function(){
/*
//参数说明:
// No1:控件的名称,需要不一样,爱加多少个随你喜欢
// No2:控件初始时的top值。
// No3:控件初始时的left值,正值为相对左的left,负数为相对右边的值
*/
new couplet(“maple1″,10,8);
new couplet(“maple2″,10,-8);
}
</script>
</head>
<body>
<div style=’height:10000px’></div>
<div id=”maple1″ style=”width:110px;height:50px;font-size:12px;”>
<div><a href=”[URL=http://lantk.588.net]http://lantk.588.net[/URL]” target=”_blank”><img src=”img/header.gif” border=”0″ /></a></div>
<div style=”background:url(img/middle.gif);height:50px;padding:4px 10px;”>
悠悠平滑对联广告,欢迎大家的使用。
点这里访问我的网站:
<a href=”[URL=http://lantk.588.net]http://lantk.588.net[/URL]” target=”_blank” style=”text-decoration:none;color:#000;”>lantk.588.net</a>
QQ:570389199<br/>
QQ群:16449874
</div>
<div><img src=”img/footer.gif” /></div>
</div>
<div id=”maple2″ style=”width:110px;height:50px;font-size:12px;”>
<div><a href=”[URL=http://lantk.588.net]http://lantk.588.net[/URL]” target=”_blank”><img src=”img/header.gif” border=”0″ /></a></div>
<div style=”background:url(img/middle.gif);height:50px;padding:4px 10px;”>
我是浮动在右边的对象,这里也没设置任何信息。
<a href=”[URL=http://lantk.588.net]http://lantk.588.net[/URL]” target=”_blank” style=”text-decoration:none;color:#000;”>lantk.588.net</a>
QQ:570389199<br/>
QQ群:16449874
</div>
<div><img src=”img/footer.gif” /></div>
</div>
</body>
</html>

以下是Js代码:
LEADBBS CODE

/* ======================================================
* 程序名: Maple Web.CMS (平滑对联广告)
* 当前版本: v1.0.0 beta
* 作者: 云端o枫o0
* 联系邮件: [EMAIL=lantk@126.com]lantk@126.com[/EMAIL]
* 腾讯QQ: 570389199
* 网站地址: [URL=http://lantk.588.net]http://lantk.588.net[/URL]
* 最后更新: 2007-11-10
* 注释: 此段代码不会影响程序执行,请尊重作者的劳动,谢谢。
* =======================================================
*/
function couplet(){
if(arguments.length>=1) this.objID = document.getElementById(arguments[0]);
if(arguments.length>=2) this.divTop = arguments[1];
if(arguments.length>=3) this.divPlane = arguments[2];
if(arguments.length>=4) this.scrollDelay = arguments[4];
if(arguments.length>=5) this.waitTime = arguments[5];
if(!this.objID){
alert(“对象名【”+ arguments[0] +”】无效,对联无法初始化,请检查对象名称是否正确!”);
this.objID = null; return;
}else{
this.objID.style.position=”absolute”;
this.objID.style.display=”block”;
this.objID.style.zIndex=9999;
}
if(“” == this.objID.style.top){
if(isNaN(this.divTop)){
alert(“对象垂直位置(top)参数必须为数字。”); return;
}else{
this.objID.style.top = this.divTop+”px”;
}
}
if(“” == this.objID.style.left && “” == this.objID.style.right){
if(isNaN(this.divPlane)){
alert(“对象水平位置(left||right)参数必须为数字。”); return;
}
if(this.divPlane>0) this.objID.style.left = this.divPlane+”px”;
if(this.divPlane<0) this.objID.style.right = Math.abs(this.divPlane)+”px”;
}
if(this.scrollDelay<15 || isNaN(this.scrollDelay)) this.scrollDelay = 15;
if(this.waitTime<500 || isNaN(this.waitTime)) this.waitTime = 500;
if(arguments.length>=1) this.start();
}
couplet.prototype.start = function(){
if(null == this.objID) return;
var objCouplet = this;
timer = this.scrollDelay;
objCouplet.lastScrollY = 0;
objCouplet.timerID = null;
objCouplet.startID = function(){
if(“block” == objCouplet.objID.style.display){
objCouplet.run();
}else{
clearInterval(objCouplet.timerID);
}
}
objCouplet.Begin = function(){
objCouplet.timerID = setInterval(objCouplet.startID,timer);
}

setTimeout(objCouplet.Begin,this.waitTime);
}
couplet.prototype.run = function(){
if(document.documentElement && document.documentElement.scrollTop){
uu_scrY = parseFloat(document.documentElement.scrollTop);
}else if(document.body){
uu_scrY = parseFloat(document.body.scrollTop);
}
uu_divX = parseFloat(this.objID.style.top.replace(“px”,”"));
uu_curTop = .1 * (uu_scrY – this.lastScrollY);
uu_curTop = uu_curTop>0?Math.ceil(uu_curTop):Math.floor(uu_curTop);
this.objID.style.top = parseFloat(uu_divX + uu_curTop) + “px”;
this.lastScrollY += uu_curTop;
}

 
http://hi.baidu.com/gg29/blog/item/437e3c2cc4ae3833349bf7d7.html

Published in JavaScript

No Responses to “js对联广告代码符合W3C标准”

Leave a Reply

请输入算式结果(看不清请点击图片)
(必须)