国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > JavaScript > 正文

JS實現很實用的對聯廣告代碼(可自適應高度)

2019-11-20 11:33:10
字體:
來源:轉載
供稿:網友

本文實例講述了JS實現很實用的對聯廣告代碼(可自適應高度)。分享給大家供大家參考。具體如下:

這是一款很實用的基于JS+CSS+DIV的網頁對聯廣告代碼,自適應網頁高度,也就是始終保持在一定調試,這款暫時沒有關閉功能。

運行效果截圖如下:

在線演示地址如下:

http://demo.VeVB.COm/js/2015/js-lr-useful-adv-auto-height-codes/

具體代碼如下:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>簡潔對聯廣告代碼</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.scrollTopelse{/*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:2px;POSITION:absolute;TOP:120px;'>ad1</div>"suspendcode14="<DIV id=/"lovexin14/" style='right:2px;POSITION: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>

希望本文所述對大家的JavaScript程序設計有所幫助。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 英德市| 东乡族自治县| 梧州市| 沙田区| 泊头市| 莒南县| 桓台县| 友谊县| 田阳县| 苏尼特左旗| 黄陵县| 西乌珠穆沁旗| 宁远县| 天柱县| 宁强县| 云安县| 丹江口市| 腾冲县| 田阳县| 吉木萨尔县| 古田县| 方城县| 政和县| 西乌| 沂水县| 兴山县| 镇江市| 凤山县| 乐山市| 孟村| 丘北县| 库尔勒市| 桐柏县| 垣曲县| 黔西| 革吉县| 调兵山市| 淮南市| 荆州市| 习水县| 沙雅县|