Back to home
雨滴js代码
2014-01-21 00:11:53 -0500
代码如下:
");}else {document.write("
");document.write(",.
"); }}function initRain() {a = 6;r[i] = 1;sn = Math.sin(a);cs = Math.cos(a);cx[i] = Math.random() * doc_width + 1;cy[i] = Math.random() * doc_height + 1;x[i] = r[i] * sn + cx[i];y[i] = cy[i];}function raindropIE() {for (i = 0; i < rainsize; ++ i) {updateRain();if ((x[i] <= 1) || (x[i] >= (doc_width- 20)) || (y[i] >= (doc_height - 20))){makeRain();doc_width = document.body.clientWidth;doc_height = document.body.clientHeight; }document.all["dot"+i].style.pixelTop = y[i];document.all["dot"+i].style.pixelLeft = x[i]; }setTimeout("raindropIE()", speed);}function updateRain() {r[i] += 10;x[i] = r[i] * sn + cx[i];y[i] = r[i] * cs + cy[i];}function makeRain() {r[i] = 1;cx[i] = Math.random() * doc_width + 1;cy[i] = 1;x[i] = r[i] * sn + cx[i];y[i] = r[i] * cs + cy[i];}raindropIE();var caution = falsefunction setCookie(name, value, expires, path, domain, secure) {var curCookie = name + "=" + escape(value) +((expires) ? "; expires=" + expires.toGMTString() : "") +((path) ? "; path=" + path : "") +((domain) ? "; domain=" + domain: "") +((secure) ? "; secure" : "")if (!caution || (name + "=" + escape(value)).length <= 4000)document.cookie = curCookieelseif (confirm("Cookie exceeds 4KB and will be cut!"))document.cookie = curCookie}function getCookie(name) {var prefix = name + "="var cookieStartIndex = document.cookie.indexOf(prefix)if (cookieStartIndex == -1)return nullvar cookieEndIndex = document.cookie.indexOf(";", cookieStartIndex + prefix.length)if (cookieEndIndex == -1)cookieEndIndex = document.cookie.lengthreturn unescape(document.cookie.substring(cookieStartIndex + prefix.length, cookieEndIndex))}function deleteCookie(name, path, domain) {if (getCookie(name)) {document.cookie = name + "=" +((path) ? "; path=" + path : "") +((domain) ? "; domain=" + domain: "") +"; expires=Thu, 01-Jan-70 00:00:01GMT"}}function fixDate(date) {var base = new Date(0)var skew = base.getTime()if (skew > 0)date.setTime(date.getTime() - skew)}var now = new Date()fixDate(now)now.setTime(now.getTime() + 365* 24 * 60 * 60 * 1000)var visits = getCookie("counter")if (!visits)visits = 1elsevisits = parseInt(visits) + 1setCookie("counter", visits, now)document.write("
您已经是第 " + visits + " 次访问本网站了!");
代码示例: