爱易网
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 浏览次数:20238 次
以下是程序代码
<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,站长
上一篇:狡猾的按钮特效
下一篇:漂浮图片不受屏幕滚动影响
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
中移动将推出多项4G资费新政
云储存有多远:跨过数据安全问题即可到达
高通拼抢国际芯片市场 联发科海外拓展难安心
联想国庆完成收购IBM x86服务器
传360周鸿祎曾试图阻止百度收购91无线
SAP高层调整:联席CEO孟鼎铭成唯一掌舵人
国网公司将加快组建 业界人士称困难重重
微软为避免代理权争夺 与大股东达成和解协议
苹果已经允许开发者提交64位应用程序
推荐阅读
更多>
传苹果与雅虎协作信息提供 进一步摆脱谷歌
亚马逊第三方平台真的卖盗版书?
都是300元内 乐视盒子与小米盒子对比体验
中移动财报外的"五座大山":运营商沦为走秀陪衬
英特尔IDF峰会启示:释放移动互联的信号
固话上网卡或将实名制 运营商泄露用户信息将被罚
小米年度发布会遭围剿!多款新品难阻品牌危机
苹果30亿美元收购Beats
网络文学竞争白热化 百度多酷文学网上线
孙正义入股阿里往事还原:阿里巴巴并非软银首选
阿里收购UC 五年姻缘换来移动新格局
宽带中国战略明确 运营商建设成本超6000亿
地图导航骤起杀机 百度高德重新定义商业模式
国网公司将加快组建 业界人士称困难重重
京东很忙:升服务推产品更新招股书 能赶在阿里前上市?
电话用户9月实名制:运营商监管受质疑
腾讯为何在与阿里百度的收购比赛中当看客?
京东联席董事长赵国庆上市前夕离职
Android版WhatsApp曝漏洞:聊天记录可被窃取
从WPS到office365,中国企业能否赶超美国?