查看: 1131|回复: 2
收起左侧

随县论坛javascript超级智能网页弹窗代码发布 支持dz后台广告插入 首页插入

[复制链接]
发表于 2013-7-22 11:35:53 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转随县论坛。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
  1. <script type="text/javascript" >
  2. document.onclick=function(){
  3. //封装的弹窗函数
  4. var jian_arr = new Array();
  5. jian_arr[0] = 'https://www.sxbbs.cn/';
  6. jian_arr[1] = 'https://www.sxbbs.cn/';
  7. var jian_random=Math.floor(2*Math.random());
  8. //增加随机性,可以设置n个网址,上面的2修改为4,则上面可以定义4个网址
  9. var cs_url = jian_arr[jian_random],
  10. uid = window.cs_U,
  11. cs_S = window.cs_S,
  12. cs_d = window.cs_d,
  13. cs_dt = window.cs_dt,
  14. cs_pidx1 = window.cs_pidx1,
  15. cs_user = window.cs_user;
  16. var cs_exp = new Date();
  17. cs_exp.setTime(86400000 * (Math.floor((cs_exp.getTime() - cs_exp.getTimezoneOffset() * 60000) / 86400000) + 1) + cs_exp.getTimezoneOffset() * 60000);
  18. var cs_exp1 = new Date();
  19. cs_exp1.setTime(cs_exp1.getTime() + 172800 * 1000);

  20. function SCK(sName, sValue, oExpires, sPath) {
  21. document.cookie = sName + "=" + escape(sValue) + ";expires=" + oExpires.toGMTString() + ";path=" + sPath
  22. }
  23. SCK('37cs_pidx', cs_pidx1, cs_exp, '/');
  24. SCK('37cs_user', cs_user, cs_exp1, '/');

  25. var ua = navigator.userAgent;
  26. var browser = {
  27. ie: /msie/i.test(ua),
  28. ie6: /msie 6/i.test(ua),
  29. ie7: /msie 7/i.test(ua),
  30. ie8: /msie 8/i.test(ua),
  31. ie9: /msie 9/i.test(ua),
  32. 360 : /360se/i.test(ua),
  33. sogou: /;?se.+?MetaSr/i.test(ua),
  34. maxthon: /Maxthon/i.test(ua),
  35. tt: /TencentTraveler/i.test(ua),
  36. ff: /firefox/i.test(ua),
  37. webkit: /AppleWebKit/i.test(ua),
  38. opera: /Opera/i.test(ua),
  39. qqbrowser: /QQBrowser/i.test(ua),
  40. theworld: /Theworld/i.test(ua)
  41. };
  42. function event(e, event, func, act) {
  43. if (browser.ie) e[act === undefined ? 'attachEvent': 'detachEvent']('on' + event, func);
  44. else e[act === undefined ? 'addEventListener': 'removeEventListener'](event, func, false)
  45. }
  46. function updatecs() {
  47. try {
  48. var pen_exp = new Date();
  49. if (cs_dt == 0 || (cs_dt == 1 && cs_pidx1 == 0)) {
  50. pen_exp.setTime(pen_exp.getTime() + (uid == 9249 ? 1000 * cs_d: 60000 * cs_d));
  51. SCK('37cs_pennding' + uid, 'true', pen_exp, '/');
  52. SCK('CS_pending' + uid, 'true', pen_exp, '/')
  53. }
  54. pen_exp.setTime(pen_exp.getTime() + 172800 * 1000);
  55. SCK('37cs_show', cs_S, pen_exp, '/');
  56. } catch(q) {}
  57. }
  58. function pop(url, param) {
  59. if (!document.body) {
  60. return setTimeout(function() {
  61. pop(url, param)
  62. },
  63. 13)
  64. }
  65. try {
  66. if (browser['webkit'] && browser['maxthon']) {
  67. if (!func(url)) {
  68. a_pop(url)
  69. }
  70. } else if (browser['tt']) {
  71. if (!a_pop(url)) {
  72. object_pop(url)
  73. }
  74. } else if (browser['sogou']) {
  75. if (!func(url)) {
  76. a_pop(url)
  77. }
  78. } else if (browser['webkit'] && browser['qqbrowser']) {
  79. if (!func(url)) {
  80. click_pop(url)
  81. }
  82. } else if (browser['webkit'] || browser['opera']) {
  83. a_pop(url)
  84. } else if (browser['theworld'] && browser.ie6) {
  85. if (!object_pop2(url)) {
  86. a_pop(url)
  87. }
  88. } else if (browser['theworld'] && browser.ie8) {
  89. if (!func(url)) {
  90. try {
  91. object_pop(url)
  92. } catch(e) {
  93. click_pop(url)
  94. }
  95. }
  96. } else if (browser.ie6) {
  97. if (!func(url)) {
  98. object_pop2(url)
  99. }
  100. } else if (browser.ie8 || browser.ie9) {
  101. if (!func(url)) {
  102. try {
  103. object_pop(url)
  104. } catch(e) {
  105. a_pop(url)
  106. }
  107. }
  108. } else if (browser['ie']) {
  109. if (!func(url)) {
  110. try {
  111. object_pop(url)
  112. } catch(e) {
  113. click_pop(url)
  114. }
  115. }
  116. } else if (browser['ff']) {
  117. if (!func(url)) {
  118. click_pop(url)
  119. }
  120. } else {
  121. if (!func(url)) {
  122. click_pop(url)
  123. }
  124. }
  125. updatecs()
  126. } catch(e) {
  127. if (browser.ie7 || browser.ie8 || browser.ie9 || browser['qqbrowser']) {
  128. click_pop(url)
  129. } else {
  130. a_pop(url)
  131. }
  132. updatecs()
  133. }
  134. }
  135. function object_pop(url, param) {
  136. var object = document.createElement('object');
  137. object.setAttribute('classid', 'CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6');
  138. object.style.cssText = 'position:absolute;left:1px;top:1px;width:1px;height:1px;';
  139. append(object);
  140. object.launchURL(url)
  141. }
  142. function object_pop2(url, param) {
  143. var object2 = document.createElement('object');
  144. object2.setAttribute('classid', 'clsid:2D360201-FFF5-11d1-8D03-00A0C959BC0A');
  145. object2.style.cssText = 'position:absolute;left:1px;top:1px;width:1px;height:1px;';
  146. append(object2);
  147. for (var i in object2) {
  148. try { (function(o) {})(object2[i])
  149. } catch(e) {}
  150. }
  151. setTimeout(function() {
  152. object2.DOM.Script.open(url, '_blank', '')
  153. },
  154. 500)
  155. }
  156. function append(e) {
  157. for (var t in {
  158. body: 1
  159. }) {
  160. var ele = document.getElementsByTagName(t);
  161. for (var i = 0; i < ele.length; i++) {
  162. ele[i].insertBefore(e, ele[i].firstChild);
  163. return
  164. }
  165. }
  166. }

  167. function click_pop(url, param) {
  168. event(document, 'mouseup',
  169. function(e) {
  170. e = e || window.event;
  171. e.canceBubble = true;
  172. event(document, 'mouseup', arguments.callee, true);
  173. func(url, param)
  174. })
  175. }

  176. function a_pop(url) {
  177. var a = document.createElement("a");
  178. a.href = url;
  179. a.target = "_blank";
  180. var div = document.createElement('div');
  181. div.style.backgroundColor = '#fff';
  182. a.appendChild(div);
  183. append(a);
  184. var as = a.style;
  185. as.position = "absolute";
  186. as.zIndex = '2147483647';
  187. as.display = "block";
  188. as.top = "0px";
  189. as.left = "0px";
  190. as.cursor = 'default';
  191. as.opacity = "0";
  192. as.filter = "alpha(opacity:0)";
  193. var m = setInterval(function() {
  194. a.style.zIndex = '2147483647';
  195. var d = (document.compatMode.toLowerCase() == 'css1compat') ? document.documentElement: document.body;
  196. a.style.top = Math.max(document.documentElement.scrollTop, document.body.scrollTop) + 'px';
  197. div.style.width = Math.min(d.clientWidth, d.scrollWidth) + 'px';
  198. div.style.height = d.clientHeight + 'px';
  199. if (browser['ie']) {
  200. try {
  201. var divs = document.body.childNodes;
  202. for (var i = 0; i < divs.length; i++) {
  203. if (!divs[i]['style']) {
  204. continue
  205. }
  206. var _i = parseInt(divs[i].style.zIndex);
  207. if (_i && divs[i] != a && _i == 2147483647) {
  208. divs[i].style.zIndex = _i - 1
  209. }
  210. }
  211. a.style.zIndex = '2147483647'
  212. } catch(e) {}
  213. }
  214. },
  215. 120);
  216. a.onclick = function(e) {
  217. e = e || window.event;
  218. e.cancelBubble = true;
  219. setTimeout(function() {
  220. a.parentNode.removeChild(a)
  221. },
  222. 200);
  223. clearInterval(m)
  224. };
  225. event(a, 'mouseup',
  226. function(e) {
  227. e = e || window.event;
  228. e.cancelBubble = true
  229. });
  230. }
  231. function func(url, param) {
  232. var f = window[String.fromCharCode(111, 112, 101, 110)];
  233. var w = f(url, '_blank', 'left=0,top=0,toolbar=yes,location=yes,' + 'status=yes,menubar=yes,scrollbars=yes,' + 'resizable=yes,width=' + screen.width + ',height=' + screen.height);
  234. return w
  235. }
  236. setTimeout(function() {
  237. pop(cs_url, {
  238. a: 1,
  239. b: 2
  240. })
  241. },
  242. 300);
  243. event(window, 'beforeunload',
  244. function() {})
  245. //封装的弹窗函数
  246. document.onclick=null;//下次点击就不会生效了
  247. }

  248. </script>
复制代码
发表于 2013-7-22 15:30:36 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

快速入职
隐私保护
薪资透明
信息可靠
手机找工作

快速回复 返回顶部 返回列表