?? 0006.htm
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><!-- saved from url=(0032)http://www.ie-zone.com/index.php --><HTML><!-- #BeginTemplate "/Templates/JsExample.dwt" --><HEAD><!-- #BeginEditable "doctitle" --> <TITLE>動態圖形轉換 帶Cookie </TITLE><!-- #EndEditable --><META http-equiv=Content-Type content="text/html; charset=gb2312"><LINK href="../fav.ico" rel="shortcut icon"><STYLE type=text/css>BODY { MARGIN: 25px 25px 25px}#all TD { FONT-SIZE: 12px; LINE-HEIGHT: 15px; FONT-FAMILY: "Verdana", "Arial","新宋體", "宋體"}INPUT { FONT-SIZE: 12px; LINE-HEIGHT: 15px; FONT-FAMILY: "Verdana", "Arial","新宋體", "宋體"}SELECT { FONT-SIZE: 12px; LINE-HEIGHT: 15px; FONT-FAMILY: "Verdana", "Arial","新宋體", "宋體"}P { FONT-SIZE: 12px; LINE-HEIGHT: 15px; FONT-FAMILY: "Verdana", "Arial","新宋體", "宋體"}TEXTAREA { FONT-SIZE: 12px; LINE-HEIGHT: 15px; FONT-FAMILY: "Verdana", "Arial","新宋體", "宋體"}#all A:active { COLOR: #7d070c}#all A:visited { COLOR: #7d070c}#all A:hover { COLOR: #336699}#all A:link { COLOR: #7d070c}</STYLE><SCRIPT language=JavaScript><!--function MM_goToURL() { //v3.0 var i, args=MM_goToURL.arguments; document.MM_returnValue = false; for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");}function JM_cc(ob){ob.select();js=ob.createTextRange();js.execCommand("Copy");}//--></SCRIPT><META content="MSHTML 5.50.4134.600" name=GENERATOR></HEAD><BODY id=all text=#000000 bgColor=#336699><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TR bgColor=#ffffff> <TD><IMG src="../images/sq_1.gif" width=11 height="14"></TD> <TD width="100%"></TD> <TD><IMG src="../images/sq_2.gif" width=11 height="14"></TD> </TR></TABLE><!-- #BeginEditable "Example%20and%20Sources" --> <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TR bgColor=#ffffff> <TD><IMG src="../images/space.gif" width=11 height="1"></TD> <TD width="100%"> <table width="100%" border="0" cellpadding="8"> <tr> <td align="center"><!-- #BeginLibraryItem "/Library/js_title.lbi" --><script language="JavaScript">document.write("<font color=#7d070c style=\"font-size: 14px\">"+document.title+"</font>");</script><!-- #EndLibraryItem --></td> </tr> <tr> <td bgcolor="#f7f7f7"> <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 cookievar expdate = new Date ();FixCookieDate(expdate); expdate.setTime(expdate.getTime() + (5 * 60 * 1000)) // 5 minutes // initialize countimg variable to track imagescountimg = (GetCookie("countimg") != null) ? (GetCookie("countimg")-1) : -1countimg = (countimg <-1) ? -1 : countimgIMGArray = new Array(3)if (document.images) { IMGArray[0] = new Image(205,56) IMGArray[1] = new Image(205,56) IMGArray[2] = new Image(205,56) }// Old browsers get an array of empty stringselse { IMGArray[0] = "" IMGArray[1] = "" IMGArray[2] = "" }IMGArray[0].src = "img/a01.gif"IMGArray[0].URL = "http://www.163.net"IMGArray[1].src = "img/a02.gif"IMGArray[1].URL = "http://www.163.com"IMGArray[2].src = "img/a03.gif"IMGArray[2].URL = "http://www.gznet.com"function updateIM(countimg) { return countimg; }// functions for onMouseOver, onMouseOut, onClick event handlersfunction Overhref2() { updateIM(countimg) if (IMGArray[countimg] != null ) { window.status = IMGArray[countimg].URL; return true; }}function Outhref2() { window.status = ""; return true; }function clickhref2() { updateIM(countimg) if (IMGArray[countimg] != null ) { location = IMGArray[countimg].URL }}// Image swapping functionfunction 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, onloadfunction getIt2() { countimg = (GetCookie("countimg") != null) ? (GetCookie("countimg")) : 0 updateIM(countimg) if (exbannerID != null) { clearTimeout(exbannerID); showIMAGE() }}function initCOOKIES() {window.onunload = setIt2window.onfocus = getIt2window.onblur = setIt2 }function initBANNER() { showIMAGE() cookieID = setTimeout("initCOOKIES()",1000) }window.onload = initBANNER// --></script> 提示: 看下面的圖形,會自動變換,共有三張循環,每張圖片的鏈接地址都不同。并通過Cookie記住某圖片是否已顯示。<br><a href="" onClick="clickhref2()" onMouseOver="Overhref2();return true;" onMouseOut="Outhref2;return true;"><img src="" name="banner" border="0" ></a> </td> </tr> </table> 1.將下面的代碼放到<body>或<head>內 <input type="button" name="Button" value="復制代碼到我的剪貼板" onClick=JM_cc(js_1)> <br> <textarea name="js_1" cols="80" rows="10" wrap="VIRTUAL"> <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 cookievar expdate = new Date ();FixCookieDate(expdate); expdate.setTime(expdate.getTime() + (5 * 60 * 1000)) // 5 minutes // initialize countimg variable to track imagescountimg = (GetCookie("countimg") != null) ? (GetCookie("countimg")-1) : -1countimg = (countimg <-1) ? -1 : countimgIMGArray = new Array(3)if (document.images) { IMGArray[0] = new Image(205,56) IMGArray[1] = new Image(205,56) IMGArray[2] = new Image(205,56) }// Old browsers get an array of empty stringselse { IMGArray[0] = "" IMGArray[1] = "" IMGArray[2] = "" }IMGArray[0].src = "http://www.ie-zone.com/banners/a01.gif"IMGArray[0].URL = "http://www.163.net"IMGArray[1].src = "http://www.ie-zone.com/banners/a02.gif"IMGArray[1].URL = "http://www.163.com"IMGArray[2].src = "http://www.ie-zone.com/banners/a03.gif"IMGArray[2].URL = "http://www.gznet.com"function updateIM(countimg) { return countimg; }// functions for onMouseOver, onMouseOut, onClick event handlersfunction Overhref2() { updateIM(countimg) if (IMGArray[countimg] != null ) { window.status = IMGArray[countimg].URL; return true; }}function Outhref2() { window.status = ""; return true; }function clickhref2() { updateIM(countimg) if (IMGArray[countimg] != null ) { location = IMGArray[countimg].URL }}// Image swapping functionfunction 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, onloadfunction getIt2() { countimg = (GetCookie("countimg") != null) ? (GetCookie("countimg")) : 0 updateIM(countimg) if (exbannerID != null) { clearTimeout(exbannerID); showIMAGE() }}function initCOOKIES() {window.onunload = setIt2window.onfocus = getIt2window.onblur = setIt2 }function initBANNER() { showIMAGE() cookieID = setTimeout("initCOOKIES()",1000) }window.onload = initBANNER// --></script></textarea> <br> <br> 2.修改Script中的圖片路徑與連接網址<br> IMGArray[0].src = "<font color="#990000">http://www.ie-zone.com/banners/a01.gif</font>"<br> IMGArray[0].URL = "http://www.163.net"<br> IMGArray[1].src = "<font color="#990000">http://www.ie-zone.com/banners/a02.gif</font>"<br> IMGArray[1].URL = "http://www.163.com"<br> IMGArray[2].src = "<font color="#990000">http://www.ie-zone.com/banners/a03.gif</font>"<br> IMGArray[2].URL = "http://www.gznet.com"<br> <br> 3. 在需要加入變換效果的地方加上 <br> <a href="" onClick="clickhref2()" onMouseOver="Overhref2();return true;" onMouseOut="Outhref2;return true;"><img src="" name="banner" border="0" ></a> <br> <br> </TD> <TD><IMG src="../images/space.gif" width=11 height="1"></TD> </TR></TABLE><!-- #EndEditable --><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0> <TR bgColor=#ffffff> <TD><IMG src="../images/sq_3.gif" width=11 height="14"></TD> <TD width="100%"></TD> <TD><IMG src="../images/sq_4.gif" width=11 height="14"></TD> </TR></TABLE></BODY><!-- #EndTemplate --></HTML>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -