爱易网
IT新闻
IT新闻
爱易资讯
网站搭建
云虚拟主机教程
云服务器教程
Apache教程
IIS教程
Nginx教程
网站策划
站长文章
推广教程
淘宝客教程
网页设计
HTML教程
XHTML教程
CSS教程
HTML5教程
CSS3教程
JavaSript基础
JQuery教程
Node.js教程
前端技术
Ajax教程
Js特效
Xml教程
平面设计
页面UI设计
photoshop教程
程序开发
AI人工智能
Asp教程
Php教程
Asp.Net教程
Net Core教程
C#教程
Java教程
Jsp教程
开发技术
微信小程序教程
Uniapp开发教程
微信公众号开发
Andriod教程
IOS教程
DOS教程
Python教程
Docker教程
Windows Container教程
数据库
MSSQL教程
MySQL教程
Redis教程
Access教程
Oracle教程
数据库教程
操作系统
Linux教程
Windows教程
MAC教程
Cisco教程
交换机教程
防火墙教程
搜索
爱易网页
JS特效
记录cookie的动态图片切换
记录cookie的动态图片切换
日期:2014-05-18 浏览次数:20171 次
以下是程序代码
<html> <head> <meta http-equiv="content-Type" content="text/html;charset=gb2312"> <meta name="keywords" content="站长,网页特效,js特效,js脚本,脚本,广告代码,zzjs,zzjs.net,sky,www.zzjs.net,站长特效 网" /> <meta name="description" content="www.zzjs.net,站长特效网,站长必备js特效及广告代码。大量高质量js特效,提供高质量广告代码下载,尽在站长特效网" /> <title>网页特效 带记录Cookie功能图片切换 站长特效网</title> <script language="JavaScript"> <!-- function getCookieVal (offset) { var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); } function FixCookieDate (date) { var base = new Date(0); var skew = base.getTime(); // dawn of (Unix) time - should be 0 if (skew > 0) // Except on the Mac - ahead of its time date.setTime (date.getTime() - skew); } function GetCookie (name) { var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if (document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if (i == 0) break; } return null; } // assign expiration date variable for cookie var expdate = new Date (); FixCookieDate(expdate); expdate.setTime(expdate.getTime() + (5 * 60 * 1000)) // 5 minutes // initialize countimg variable to track images countimg = (GetCookie("countimg") != null) ? (GetCookie("countimg")-1) : -1 countimg = (countimg <-1) ? -1 : countimg IMGArray = new Array(3) if (document.images) { IMGArray[0] = new Image(400,300) IMGArray[1] = new Image(400,300) IMGArray[2] = new Image(400,300) } // Old browsers get an array of empty strings else { IMGArray[0] = "" IMGArray[1] = "" IMGArray[2] = "" } IMGArray[0].src = "/image/1.jpg" IMGArray[0].URL = "http://www.zzjs.net" IMGArray[1].src = "/image/2.jpg" IMGArray[1].URL = "http://www.zzjs.net" IMGArray[2].src = "/image/3.jpg" IMGArray[2].URL = "http://www.zzjs.net" function updateIM(countimg) { return countimg; } // functions for onMouseOver, onMouseOut, onClick event handlers function zzjs_net_over() { updateIM(countimg) if (IMGArray[countimg] != null ) { window.status = IMGArray[countimg].URL; return true; }} function zzjs_net_out() { window.status = ""; return true; } function zzjs_net_click() { updateIM(countimg) if (IMGArray[countimg] != null ) { location = IMGArray[countimg].URL }} // Image swapping function function showIMAGE() { updateIM(countimg++) if (document.images) { // Make sure countimg does'nt get too big if ( countimg > IMGArray.length - 1 ) { countimg = IMGArray.length - IMGArray.length } document.images.banner.src = IMGArray[countimg].src exbannerID = setTimeout("showIMAGE()",2500) }} function setIt2() { updateIM(countimg) document.cookie = "countimg=" + countimg + "; expires=" + expdate.toGMTString() } // get cookie countimg onblur, onload function getIt2() { countimg = (GetCookie("countimg") != null) ? (GetCookie("countimg")) : 0 updateIM(countimg) if (exbannerID != null) { clearTimeout(exbannerID); showIMAGE() }} function initCOOKIES() { window.onunload = setIt2 window.onfocus = getIt2 window.onblur = setIt2 } function initBANNER() { showIMAGE() cookieID = setTimeout("initCOOKIES()",1000) } window.onload = initBANNER // --> </script> </head> <body> <a href="http://www.zzjs.net/">站长特效网</a>,站长必备的高质量网页特效和广告代码。zzjs.net,站长
上一篇:狡猾的按钮特效
下一篇:漂浮图片不受屏幕滚动影响
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
小米移动芯片:英伟达退出,终会加强与联发科合作
论:三大运营商运用商店逆袭并非不能够
人们为什么总愿尝试新社交网络?
CSS控制字符长度和显示长度
打车软件火了 恶性循环来了
移动联通回应税率改革:短期内收入利润将大减
英特尔技术高管离任 电视业务或受影响
iOS7拖累iPad 5、iPad mini2发布 传十月份推出
央行暂停二维码支付及虚拟信用卡 支付宝微信不知情
推荐阅读
更多>
虚拟运营商前路迷茫 业界建议发力车联网
“合聚变”来了 UC优视确认并入阿里巴巴
凑足了升级ios8所需要的5.7G空间,没料到“苹果”却变成“板砖”,iOS8还能一起愉快玩耍吗?
支付宝被曝严重破绽 隐私平安再受质疑
微软史上最大规模裁员,一半诺基亚员工
中移动落马高管盘点:广东移动成反腐重地
国美痛批网购七宗罪 用短暂盈利输了未来
探析APP移动营销发扬实效的微妙
阿里巴巴上市后雅虎将面临更大的业绩压力
568倍PE,“长跑者”亚马逊的高估值之谜
称产品遭诋毁 奇虎再诉百度
谷歌董事长成花花公子:情史足以媲美涂鸦
曹国伟:微博将关注Facebook和Twitter
评论:马云的成功建立在什么基础上很值得怀疑
亚马逊推特价闪购纪念入华十周年 总裁一职仍空缺
微软不会被颠覆
巧用百度推行系统 突显竞价效果
高通拼抢国际芯片市场 联发科海外拓展难安心
网络文学竞争白热化 百度多酷文学网上线
中国雅虎邮箱今日关停 由盛及衰的背后