Auto drop down / shrink ad code at the top of the page (imitating JD)

From , 5 Years ago, written in JavaScript, viewed 135 times.
URL https://pastebin.vip/view/fbd7939d
  1. <!doctype html public "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" lang="gb2312">
  3. <head>
  4. <title>网页顶部自动下拉/收缩广告代码(仿京东)</title>
  5. <meta http-equiv="content-type" content="text/html; charset=gb2312" />
  6. <script type="text/javascript">
  7. var intervalId = null;
  8. function slideAd(id, nStayTime, sState, nMaxHth, nMinHth)
  9. {
  10.     this.stayTime = nStayTime * 1000 || 3000;
  11.     this.maxHeigth = nMaxHth || 381;
  12.     this.minHeigth = nMinHth || 1;
  13.     this.state = sState || "down";
  14.     var obj = document.getElementById(id);
  15.     if (intervalId != null)
  16.         window.clearInterval(intervalId);
  17.     function openBox()
  18.     {
  19.         var h = obj.offsetHeight;
  20.         obj.style.height = ((this.state == "down") ? (h + 2) : (h - 2)) + "px";
  21.         if (obj.offsetHeight > this.maxHeigth)
  22.         {
  23.             window.clearInterval(intervalId);
  24.             intervalId = window.setInterval(closeBox, this.stayTime);
  25.         }
  26.         if (obj.offsetHeight < this.minHeigth)
  27.         {
  28.             window.clearInterval(intervalId);
  29.             obj.style.display = "none";
  30.         }
  31.     }
  32.     function closeBox()
  33.     {
  34.         slideAd(id, this.stayTime, "up", nMaxHth, nMinHth);
  35.     }
  36.     intervalId = window.setInterval(openBox, 10);
  37. }
  38. </script>
  39. <style type="text/css">
  40. #MyMoveAd {
  41.         overflow:hidden;
  42.         text-align: center;
  43.         height: 0px;
  44.         background-color: #AC010A;
  45.         background-image: url(ad.jpg);
  46.         background-repeat: no-repeat;
  47.         background-position: center center;
  48.         display: block;
  49. }
  50. </style>
  51. </head>
  52. <body>
  53. <a href="#" id="MyMoveAd"> </a>
  54. <br>
  55. <br>
  56. <h1 style="text-align:center"><a href="http://yuncode.net" target="_blank">更多源代码下载</a></h1>
  57. <script type="text/javascript">
  58.  <!--
  59.  slideAd('MyMoveAd',3);
  60. -->
  61. </script>
  62. </body>
  63. </html>
  64.  

Reply to "Auto drop down / shrink ad code at the top of the page (imitating JD)"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website