左手的爱 发表于 2013-4-2 14:03
不错 有演示站吗
有的,今天又对伸缩代码的图片添加了文字标签
有图为证
以下是修改过的广告代码,使用的时候请修改里面图片的高度和宽度为你的广告图片宽度
红色的地方请根据实际情况更改
以下代码里351是伸缩图片的高度,980为图片的宽度,看演示请移步到(京南建材网)查看- <!--通栏收缩广告开始 -->
- <script type="text/javascript">
- var intervalId = null;
- function slideAd(id,nStayTime,sState,nMaxHth,nMinHth){
- this.stayTime=nStayTime*1000 || 3000;
- this.maxHeigth=nMaxHth ||<font color="#ff0000"> 351</font>;
- this.minHeigth=nMinHth || 2.5;
- this.state=sState || "down" ;
- var obj = document.getElementById(id);
- if(intervalId != null)window.clearInterval(intervalId);
- function openBox(){
- var h = obj.offsetHeight;
- obj.style.height = ((this.state == "down") ? (h + 2) : (h - 2))+"px";
- if(obj.offsetHeight>this.maxHeigth){
- window.clearInterval(intervalId);
- intervalId=window.setInterval(closeBox,this.stayTime);
- }
- if (obj.offsetHeight<this.minHeigth){
- window.clearInterval(intervalId);
- obj.style.display="none";
- }
- }
- function closeBox(){
- slideAd(id,this.stayTime,"up",nMaxHth,nMinHth);
- }
- intervalId = window.setInterval(openBox,30);
- }
- </script>
- <div id="MyMoveAd" style="background:#ff0000;height:12px;overflow:hidden;">
- <a title="现在加入京南建材网诚信商会员企业店铺三年仅需一年钱
- " target="_blank"><img src="<font color="#ff0000">ad/cxs/cxs3.jpg</font>" border="0" /></a>
- </div>
-
- <script type="text/javascript">
- <!--
- slideAd('MyMoveAd',5);
- -->
- </script>
- <table width="<font color="#ff0000">980</font>" border="0" cellspacing="0" cellpadding="0" id="jueban" style="background:red;display: ">
- <tr><td height=""><a title="现在加入京南建材网诚信商会员企业店铺三年仅需一年钱
- " target="_blank">
- <img src="<font color="#ff0000">ad/cxs/cxs2.jpg</font>" border="0"></a></td></tr></table>
- <!--通栏收缩广告结束 -->
复制代码 |