爱易网
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 浏览次数:20099 次
以下是程序代码
<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,站长
上一篇:狡猾的按钮特效
下一篇:漂浮图片不受屏幕滚动影响
免责声明:
本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
相关资料
更多>
可靠消息称微型针孔偷拍设备拟全面禁止
HTC以品牌营销突围 专家建议改变经营思路
小米2S试水高端化 纯“性价比”玩法已成过去式
同为70前后人,马云为什么总是像外星人那么瘦
苹果售后生态链乱象:供需失衡价钱不一
易迅大众点评缩水执行“七天后悔权”被约谈
携程整合去哪儿陷入僵局 欲联手老对手艺龙
蘑菇街CEO陈琪:2015将回归社会化电商
微软的云服务显示出他们将自我进化
推荐阅读
更多>
亚马逊落户上海自贸区:美国货直邮中国
优酷土豆兼并一年:依然处于烧钱形状
安全服务机构:公布2014年度最糟糕的25个密码
流浪汉高考状元终于找到工作:月薪3000做程序员很满意
金山毒霸安全中心: XP退役后首个高危漏洞来了
苹果CEO抱歉解读:是战略而非“屈服”
迅雷欲3300万美元收购金山快盘 预计9月完成
从WPS到office365,中国企业能否赶超美国?
薛蛮子取保后首次发微博表示:辜负你们了
工商总局开查电商“七日退货”
组建铁塔公司倒逼运营商改革 或加速4G网建设
猎豹移动上市押海外市场 与小米有合作空间
论:三大运营商运用商店逆袭并非不能够
中移动五大基地将整改成公司:被指易滋生腐败
柳传志马云陷舆论漩涡:请不要辜负这个时代
传谷歌开发者大会发布Android 4.3 并非5.0版本
地图导航骤起杀机 百度高德重新定义商业模式
如家撤离同程内情:祸起反水OTA“联盟”?
9158屌丝逆袭 从在线“夜总会”转型KTV
刘强东:京东上市融资用于开拓三至六线城市