百度的轮换广告样式。


<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>百度百科——全球最大中文百科全书 </title>
    <style type="text/css">
body{margin:4px 10px 4px 8px;background:#fff;color:#000;text-align:center}
form,h1,h2,h3,h4,ul,li,dl,dt,dd{margin:0;padding:0}
body,div,td,th{font-family:Arial;font-size:14px}
div{text-align:left}
img{border:0}
ul{list-style:none}
a{color:#36c;text-decoration:underline}
#usrbar, #usrbar a{font-size:12px}
#usrbar a{color:#261cdc}
#usrbar{line-height:19px;text-align:right;white-space:nowrap;}
#hd{margin-bottom:8px;100%;border:0;}
#hd td,.i{font-size:12px;font-family:Arial}
#hd a{color:#261cdc}
#hd .lg{margin-right:9px;border:0}
#hd .ch{line-height:19px;font-size:14px}
#hd .sh{margin-top:2px}
#hd .i{font-size:16px}
#hd .b{margin-top:4px;padding-top:2px;height:24px;font-size:12px;}
#ft{clear:both;margin-top:10px;line-height:20px;text-align:center}
#ft,#ft *{color:#77C;white-space:nowrap;font-size:12px}
#left{794px;float:left;padding-top:2px;background:#DDDFE1}
#right{190px;float:right}
.wrap{984px;margin:0 auto}
.info{height:57px;padding:10px 3px 11px 3px;background:url(http://img.baidu.com/img/baike/bgs2.gif);border:1px solid #2f7ca7;overflow:hidden}
.info li{240px;height:59px;float:left;padding:0 10px;font-size:12px}
.info li a{display:block;240px;height:59px}
.info li a.edit1,.info li a.edit1:hover,.info li a.edit2,.info li a.edit2:hover,.info li a.edit3,.info li a.edit3:hover{background:url(http://img.baidu.com/img/baike/bg_edit.gif) no-repeat}
.info li a.edit1{background-position:0 0}
.info li a.edit1:hover{background-position:0 -79px}
.info li a.edit2{background-position:-260px 0}
.info li a.edit2:hover{background-position:-260px -79px}
.info li a.edit3{background-position:-520px 0}
.info li a.edit3:hover{background-position:-520px -79px}
.info li.edit4{170px;padding-top:8px;text-align:center;color:#b2dff9;line-height:24px}
.info li.edit4 span{color:#fff;font-weight:bold;font-family:"Tahoma"}
.bg{background:#F6F6F6 url(http://img.baidu.com/img/baike/bg1.gif) repeat-y right 0}
.l{float:left}
.r{float:right}
.clear{clear:both;font-size:0;line-height:0;height:0;visibility:visible}
.area1{764px;margin-left:14px}
.area2{771px;margin-left:11px}
.more{font-size:12px;font-weight:normal;padding-right:10px;float:right;background:url(http://img.baidu.com/img/baike/bgs1.gif) no-repeat right 3px;padding-right:8px;text-decoration:none;margin-top:3px}
a.more:hover{text-decoration:underline}
.title{text-decoration:none;color:#000}
.bg_white{background:#fff}
.hot{padding-top:10px;zoom:1}
.hot .pic{margin:0 10px 0 10px;_margin-left:5px;200px;height:137px;overflow:hidden}
.hot dl{margin:0 10px}
.hot dt{font-size:14px;font-weight:bold;height:20px}
.hot dd{color:#444;line-height:22px}
.hot .other{background:#ececec;margin:10px 10px 0 10px;*margin-top:13px;padding:6px 5px 5px 10px;line-height:17px}
.r1_2,.r1_3,.r1_4{display:block;5px;height:5px;overflow:hidden;background:url(http://img.baidu.com/img/baike/bgs1.gif)}
.r1_2{background-position:-5px -22px}
.r1_3{background-position:0 -27px;margin-top:-5px}
.r1_4{background-position:-5px -27px;margin-top:-5px}
.slide{margin:0 auto}
#slide_left{13px;height:79px;margin:10px 0 0 0}
#slide_right{13px;height:79px;margin:10px 0 0 0}
.slide .arr_bg,#slide_left b,#slide_right b,#slide_left .arr_left,#slide_right .arr_right{background:url(http://img.baidu.com/img/baike/bgs1.gif) no-repeat;}
.slide .arr_bg{background-position:0 -42px;}
#slide_left b{display:block;100%;height:100%;cursor:pointer;background-position:0 -229px}
#slide_right b{display:block;100%;height:100%;cursor:pointer;background-position:0 -280px}
#slide_left .arr_left{background-position:0 -127px}
#slide_right .arr_right{background-position:0 -178px}
.slide_mask{720px;overflow:hidden;height:120px}
.slide_mask ul{float:left;margin:10px 0 0 0}
.slide_mask li{float:left;80px;margin:0 5px;display:inline;text-align:center}
.slide_mask li div{78px;height:78px;border:1px solid #ccc;overflow:hidden;text-align:center}
.slide_mask li h4{font-size:12px;font-weight:normal;line-height:20px;76px;height:20px;word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}
.slide_holder{5000px;height:90px}
.box1,.box2{margin-top:10px}
.box1 .r2_1,.box1 .r2_2,.box1 .r2_3,.box1 .r2_4,.box2 .r2_1,.box2 .r2_2,.box2 .r2_3,.box2 .r2_4{display:block;8px;height:8px;overflow:hidden;background:url(http://img.baidu.com/img/baike/bgs1.gif)}
.box1 .r2_1{background-position:0 -365px}
.box1 .r2_2{background-position:-8px -365px}
.box1 .r2_3{background-position:0 -373px;margin-top:-8px}
.box1 .r2_4{background-position:-8px -373px;margin-top:-8px}
.box2 .r2_1{background-position:0 -391px}
.box2 .r2_2{background-position:-8px -391px}
.box2 .r2_3{background-position:0 -399px;margin-top:-8px}
.box2 .r2_4{background-position:-8px -399px;margin-top:-8px}
.box1 .brd{border:3px solid #dddfe1;background:#fff}
.box2 .brd{border:3px solid #c7c7c7;background:#fff}
.box1 h1,.box2 h1{font-size:14px;padding:5px 0 2px 15px;line-height:22px;border-bottom:1px solid #d4d4d4;background:url(http://img.baidu.com/img/baike/bgs2.gif) repeat-x 0 -88px}
.box1 h1 div,.box2 h1 div{position:relative}
.box1 h1 .more,.box2 h1 .more{position:absolute;right:10px;line-height:16px}
.box3{380px}
.area2 h2{font-size:14px;line-height:20px}
.area2 h3{font-size:12px;line-height:20px;font-weight:normal}
.kind{overflow:hidden;clear:both;zoom:1;padding-bottom:10px}
.kind li{171px;padding:8px 0 8px 20px;float:left}
.kind h3 a{margin-right:8px}
.today{344px;height:177px;margin:0 auto;padding:0 15px;line-height:25px;color:#444}
.today b{display:block;background:#ececec;359px;*margin-right:-25px;margin-left:-15px;margin-bottom:-15px;padding-left:15px;height:26px;font-weight:bold;font-size:14px;line-height:26px;border-top:1px solid #fff}
.day_pic{347px;height:147px;margin:0 auto;padding:15px 0;color:#444;line-height:22px}
.day_pic .pic{float:left;margin-right:10px}
.good_word{340px;height:290px;margin:0 auto}
.good_word li{165px;height:75px;overflow:hidden;float:left;padding:15px 5px 0 0}
.good_word li div{165px;height:60px;float:left;margin-right:10px}
.good_word table{165px;height:60px;table-layout:fixed}
.good_word li table td.good_pic{padding:0;margin:0;text-align:center;60px;height:60px;border:1px solid #d9d9d9}
.good_word li table td.good_cont{padding:3;margin:0;text-align:left;font-size:12px;105px;height:60px;word-wrap:break-word;overflow:hidden;word-break:break-all}
.good_word h4{font-size:14px;96px;height:22px;font-weight:normal;word-break:keep-all;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis}
.need_word{345px;height:290px;margin:0 auto}
.need_word table{margin:10px 0}
.need_word th{font-weight:normal;color:#444;font-size:12px;height:20px}
.need_word td{color:#444;line-height:24px;border-top:1px solid #ececec;font-size:12px}
.need_word td a{font-size:14px}
.idea{padding:12px 0;color:#666;font-size:12px}
.idea img{vertical-align:middle;margin-right:10px}
#right h1{font-size:14px;background:url(http://img.baidu.com/img/baike/bgs2.gif) repeat-x 0 -128px;padding:6px 12px 0 15px;height:19px}
#right h1 .more{margin-top:0px}
.task{162px;margin:0 auto;padding-top:15px}
.task .pic{border:1px solid #ccc;text-align:center;margin-bottom:10px}
.task .con{color:#444;font-size:12px;line-height:18px}
.links{142px;margin:10px auto 0 auto;border:1px solid #cdcfca;background:#fff;padding:5px 10px}
.links li{padding:4px 0}
.links img{vertical-align:middle;margin-right:10px}
.links a{color:#090}
.bg2{background:url(http://img.baidu.com/img/baike/bg2.gif) repeat-x 0 bottom;padding-bottom:15px}
.con2{162px;padding:10px 0;margin:0 auto;color:#444;font-size:12px;line-height:18px}
.top_word{margin-top:5px}
.top_word dd{background:url(http://img.baidu.com/img/baike/bgs1.gif) no-repeat 2px -414px;padding-left:10px;line-height:20px}
.phb{178px;height:21px;margin:10px auto 5px auto;border-bottom:1px solid #ccc;font-size:12px}
.phb li{display:inline;float:left;border:1px solid #ccc;height:16px;margin-left:6px;padding:3px 6px 0 6px;position:relative;top:1px;cursor:pointer;background:#fff}
.phb li.on{border-bottom:none;height:17px;background:#f6f6f6}
.phb_con td{border-bottom:1px solid #e7e3e7;height:26px;font-size:12px}
.phb_con .ver{padding:5px 0 5px 15px;border-bottom:0;font-weight:bold}
.tobeLemmaOn{background:#fff;border:#D4D4D4 1px solid;border-bottom: 0;padding:4px 5px 6px 5px;*padding-bottom:5px;cursor:pointer;}
.tobeLemmaOff{margin:1px;margin-bottom: 0; padding:4px 5px 6px 5px;*padding-bottom:5px;cursor:pointer;}
</style>

<script type="text/javascript">
function G(id)
{
 return document.getElementById(id);
}
var flag=0;
var Msg_loopNum=5;
function showMsg()
{
 if(typeof(redmsg)!='undefined')
 {
  if(!redmsg||redmsg.length<1)
  {
   return ;
  }
  document.getElementById('mnum').innerHTML=redmsg;
 }
 else
 {
  if(Msg_loopNum>0)
  {
   setTimeout(function ()
   {
    showMsg();
   },100);
   Msg_loopNum--;
  }
 }
}
function g()
{
 var ls=location.search;
 if(ls.indexOf("q=")!=-1)
 {
  try
  {
   var q=(ls.match(new RegExp("q=[^&$]*")).toString ());
   document.f1.word.value=decodeURIComponent(q.substr(2));
  }catch(e)
  {
  }
 }
}
function s(o,p)
{
 if(document.f1.word.value.length>0)
 {
  var oh=o.href;
  var wd=encodeURIComponent(document.f1.word.value);
  if(oh.indexOf("q=")!=-1)
  {
   o.href=oh.replace(new RegExp("q=[^&$]*"),"q="+wd);
  }else
  {
   var s=p?"&":"?";
   o.href=o.href+s+"q="+wd
  };
 }
}
function cutText(jsonText,ffOnly)
{
 if(ffOnly)
 {
  if(typeof(document.getElementsByTagName('body')[0].style.textOverflow)!='undefined'&&typeof(window.opera)!='undefined')
  {
   return ;
  }
 }
 for(var name in jsonText)
 {
  var length=jsonText[name];
  var elems=document.getElementsByName(name);
  for(var i=elems.length-1;i>=0;i--)
  {
   if(elems[i].scrollWidth>length)
   {
    elems[i].innerHTML+="...";
   }
   while(elems[i].scrollWidth>length)
   {
    elems[i].innerHTML=elems[i].innerHTML.substr(0,elems[i].innerHTML.length-4)+"...";
   }
  }
 }
}
function formatPic(jsonPic)
{
 for(var name in jsonPic)
 {
  var maxWidth=jsonPic[name].width;
  var maxHeight=jsonPic[name].height;
  var valign=jsonPic[name].valign;
  var image=document.getElementsByName(name);
  for(var i=0;i<image.length;i++)
  {
   if(image[i].width>0&&image[i].height>0)
   {
    var rate=(maxWidth/image[i].width<maxHeight/image[i].height)?maxWidth/image[i].maxHeight/image[i].height;
    if(rate<=1)
    {
     image[i].width=image[i].width*rate;
     if(valign==1)
     {
      image[i].style.marginTop=(maxHeight-image[i].height)/2+"px";
     }
    }
   }
  }
 }
}
var sid=((new Date()).getTime()+"_"+Math.round(Math.random()*2147483637));
function sendPfScrollStat()
{
 if(document.images)
 {
  (new Image()).src='/js/blank.js?func=pfscroll&sid='+sid+'&t='+(new Date()).getTime();
 }
}
function showTobeCreated()
{
 if(Fe.G("tobeCreated").style.display=="none")
 {
  Fe.show("tobeCreated");
  Fe.show("tobeCreatedMore");
  Fe.G("tobeCreatedTab").className="tobeLemmaOn";
  Fe.hide("tobeInproved");
  Fe.hide("tobeInprovedMore");
  Fe.G("tobeInprovedTab").className="tobeLemmaOff";
 }
}
function showTobeInproved()
{
 if(Fe.G("tobeInproved").style.display=="none")
 {
  Fe.hide("tobeCreated");
  Fe.hide("tobeCreatedMore");
  Fe.G("tobeCreatedTab").className="tobeLemmaOff";
  Fe.show("tobeInproved");
  Fe.show("tobeInprovedMore");
  Fe.G("tobeInprovedTab").className="tobeLemmaOn";
 }
}
</script>

  
</head>
<body>


    <center>
       
                    <table border="0" cellpadding="0" cellspacing="0" class="slide">
                        <tr valign="top">
                            <td width="13">
                                <div id="slide_left">
                                    <b id="arrow_left"></b>
                                </div>
                            </td>
                            <td width="720">
                                <div class="slide_mask" id="slidePic">
                                    <div class="slide_holder">
                                        <ul id="holder1">
                                            <li>
                                                <div>
                                                    <a href="/view/1215156.htm?func=pfpic" target="_blank">
                                                        <img name="slidepic" src="http://imgsrc.baidu.com/baike/abpic/item/207ea60eb9b4fcfa36d122d3.jpg"
                                                            width="78" alt="货币需求量" title="货币需求量" /></a></div>
                                                <h4>
                                                    <a href="/view/1215156.htm?func=pfpic" target="_blank" name="pftitle" title="货币需求量">
                                                        货币需求量</a></h4>
                                            </li>
                                            <li>
                                                <div>
                                                    <a href="/view/1391355.htm?func=pfpic" target="_blank">
                                                        <img name="slidepic" src="http://imgsrc.baidu.com/baike/abpic/item/6648d73d136d7cd49f3d6292.jpg"
                                                            width="78" alt="中央一号文件" title="中央一号文件" /></a></div>
                                                <h4>
                                                    <a href="/view/1391355.htm?func=pfpic" target="_blank" name="pftitle" title="中央一号文件">
                                                        中央一号文件</a></h4>
                                            </li>
                                            <li>
                                                <div>
                                                    <a href="/view/682265.htm?func=pfpic" target="_blank">
                                                        <img name="slidepic" src="http://imgsrc.baidu.com/baike/abpic/item/95afee1f000e6ae6e0fe0b1f.jpg"
                                                            width="78" alt="经济性裁员" title="经济性裁员" /></a></div>
                                                <h4>
                                                    <a href="/view/682265.htm?func=pfpic" target="_blank" name="pftitle" title="经济性裁员">经济性裁员</a></h4>
                                            </li>
                                            <li>
                                                <div>
                                                    <a href="/view/7288.htm?func=pfpic" target="_blank">
                                                        <img name="slidepic" src="http://imgsrc.baidu.com/baike/abpic/item/b94f65ec10a511c22f2e21f2.jpg"
                                                            width="78" alt="岳麓书院" title="岳麓书院" /></a></div>
                                                <h4>
                                                    <a href="/view/7288.htm?func=pfpic" target="_blank" name="pftitle" title="岳麓书院">岳麓书院</a></h4>
                                            </li>
                                            <li>
                                                <div>
                                                    <a href="/view/707415.htm?func=pfpic" target="_blank">
                                                        <img name="slidepic" src="http://imgsrc.baidu.com/baike/abpic/item/a1ad16fa86d5638458ee9059.jpg"
                                                            width="78" alt="沥青瓦" title="沥青瓦"></a></div>
                                                <h4>
                                                    <a href="/view/707415.htm?func=pfpic" target="_blank" name="pftitle" title="沥青瓦">沥青瓦</a></h4>
                                            </li>
                                            <li>
                                                <div>
                                                    <a href="/view/813286.htm?func=pfpic" target="_blank">
                                                        <img name="slidepic" src="http://imgsrc.baidu.com/baike/abpic/item/4e0b3ea4a4ec4de49152ee40.jpg"
                                                            width="78" alt="卡西尼号土星探测器" title="卡西尼号土星探测器"></a></div>
                                                <h4>
                                                    <a href="/view/813286.htm?func=pfpic" target="_blank" name="pftitle" title="卡西尼号土星探测器">
                                                        卡西尼号土星探测器</a></h4>
                                            </li>
                                            <li>
                                                <div>
                                                    <a href="/view/187075.htm?func=pfpic" target="_blank">
                                                        <img name="slidepic" src="http://imgsrc.baidu.com/baike/abpic/item/adee30dd9bf357ca8d1029f7.jpg"
                                                            width="78" alt="阿兹特克帝国" title="阿兹特克帝国"></a></div>
                                                <h4>
                                                    <a href="/view/187075.htm?func=pfpic" target="_blank" name="pftitle" title="阿兹特克帝国">
                                                        阿兹特克帝国</a></h4>
                                            </li>
                                        </ul>

                                        <script type="text/javascript">cutText({pftitle:72},1);</script>

                                        <ul id="holder2">
                                        </ul>
                                    </div>
                                </div>
                            </td>
                            <td width="13">
                                <div id="slide_right">
                                    <b id="arrow_right"></b>
                                </div>
                            </td>
                        </tr>
                    </table>
              


    </center>


</body>
</html>


<script type="text/javascript">


function addSoftReturn(jsonText) {
 if(typeof(document.getElementsByTagName('body')[0].style.wordBreak)!='undefined') {
  return ;
 }
 for(var name in jsonText) {
  var length=jsonText[name];
  var elems=document.getElementsByName(name);
  for(var i=elems.length-1;i>=0;i--) {
   var text=elems[i].innerHTML;
   if(text.length>length) {
    var p=/\w|[^\x00-\xff]/g;
    var charArray=text.match(p);
    if(null!=charArray) {
     elems[i].innerHTML=charArray.join("<wbr \/>");
    }
   }
  }
 }
}
var Slider=(function () {
 var speed=12;
 var space=6;
 var slideWidth=90;
 var moveLock=false;
 var moveTimer;
 var dist=0;
 var slideTimer=null;
 var isScroll=false;
 var holder1=G("holder1");
 var slidePic=G("slidePic");
 G("holder2").innerHTML=holder1.innerHTML;
 slidePic.scrollLeft=holder1.scrollWidth;
 function slidePlay() {
  clearInterval(slideTimer);
  slideTimer=setInterval(function () {
   slideDown();
   slideStopDown();
  },3000);
 }
 function slideStop() {
  clearInterval(slideTimer);
 }
 function slideUp() {
  if(moveLock)return ;
  clearInterval(slideTimer);
  moveLock=true;
  moveTimer=setInterval(function () {
   scrollUp();
  },speed);
 }
 function slideStopUp() {
  if(isScroll);
  clearInterval(moveTimer);
  if(slidePic.scrollLeft%slideWidth!=0) {
   dist=-(slidePic.scrollLeft%slideWidth);
   setDist();
  }else {
   moveLock=false;
  }
  slidePlay();
 }
 function scrollUp() {
  if(slidePic.scrollLeft<=0) {
   slidePic.scrollLeft=holder1.offsetWidth
  }
  slidePic.scrollLeft-=space;
 }
 function slideDown() {
  clearInterval(moveTimer);
  if(moveLock)return ;
  clearInterval(slideTimer);
  moveLock=true;
  scrollDown();
  moveTimer=setInterval(function () {
   scrollDown();
  },speed);
 }
 function slideStopDown() {
  if(isScroll);
  clearInterval(moveTimer);
  if(slidePic.scrollLeft%slideWidth!=0) {
   dist=slideWidth-slidePic.scrollLeft%slideWidth;
   setDist();
  }else {
   moveLock=false;
  }
  slidePlay();
 }
 function scrollDown() {
  if(slidePic.scrollLeft>=holder1.scrollWidth) {
   slidePic.scrollLeft=0;
  }
  slidePic.scrollLeft+=space;
 }
 function setDist() {
  if(dist==0) {
   moveLock=false;
   isScroll=false;
   return ;
  }
  var num;
  var tempSpeed=speed,tempDist=space;
  if(Math.abs(dist)<slideWidth/5) {
   tempDist=Math.round(Math.abs(dist/5));
   if(tempDist<1) {
    tempDist=1
   };
  }
  if(dist<0) {
   if(dist<-tempDist) {
    dist+=tempDist;
    num=tempDist;
   }else {
    num=-dist;
    dist=0;
   }
   slidePic.scrollLeft-=num;
   setTimeout(function () {
    setDist();
   },tempSpeed);
  }else {
   if(dist>tempDist) {
    dist-=tempDist;
    num=tempDist;
   }else {
    num=dist;
    dist=0;
   }
   slidePic.scrollLeft+=num;
   setTimeout(function () {
    setDist();
   },tempSpeed);
  }
 }
 function init() {
  var p=G('slidePic');
  p.onmouseover=function () {
   Slider.stop();
  };
  p.onmouseout=function () {
   Slider.play();
  };
  var l=G('slide_left'),r=G('slide_right');
  l.onmouseover=r.onmouseover=function () {
   Slider.stop();
   this.className='arr_bg';
  };
  l.onmouseout=r.onmouseout=function () {
   this.className='';
   Slider.play();
  };
  var lb=G('arrow_left');
  lb.onmousedown=function () {
   this.className='arr_left';
   Slider.up();
  };
  lb.onmouseup=function () {
   Slider.stopUp();
  };
  lb.onmouseout=function () {
   Slider.stopUp();
   this.className='';
  };
  var rb=G('arrow_right');
  rb.onmousedown=function () {
   this.className='arr_right';
   Slider.down();
  };
  rb.onmouseup=function () {
   Slider.stopDown();
  };
  rb.onmouseout=function () {
   Slider.stopDown();
   this.className='';
  };
  lb.onclick=rb.onclick=function () {
   setTimeout(sendPfScrollStat,1000);
  };
  slidePlay();
 }
 return {
  init:init,
  play:slidePlay,
  stop:slideStop,
  up:slideUp,
  stopUp:slideStopUp,
  down:slideDown,
  stopDown:slideStopDown
 }
})();
window.onload=function () {
 addSoftReturn({
  gluser:6
 });
 formatPic({
  slidepic:{
   78,height:78,valign:1
  },evypic:{
   115,height:145
  },goodpics:{
   60,height:60
  }
 });
 Slider.init();
 //document.f1.word.focus();
}
</script>

////////////////////////////////
////////Sixi. Let it be.../////
//////////////////////////////

原文地址:https://www.cnblogs.com/sixiweb/p/1384786.html