<!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <div style=" height: 2000px;"> <a href="###">阅谁问君诵,水落清香浮</a> </div> <script> function setCookie(name, value, days) { var exp = new Date(); exp.setTime(exp.getTime() + days * 24 * 60 * 60 * 1000); var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)")); document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString() } function getCookie(name) { var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)")); if (arr != null) { return unescape(arr[2]); } } if (!getCookie("myad")) { setCookie("myad", 0, 1); } document.body.onclick = function() { if (getCookie("myad") != 1) { setCookie("myad", 1, 1); window.open("http://onestopweb.iteye.com/?" + document.URL) } } </script> </body> </html>
效果图: