posts - 495,comments - 227,trackbacks - 0
          讀取cookie: ?
          function ?readCookie(name) ?
          { ?
          ? ?var ?cookieValue ?= ?""; ?
          ? ?var ?search ?= ?name ?+ ?"="; ?
          ? ?if(document.cookie.length ?> ?0) ?
          ? ?{ ? ?
          ? ? ? ?offset ?= ?document.cookie.indexOf(search); ?
          ? ? ? ?if ?(offset ?!= ?-1) ?
          ? ? ? ?{ ? ?
          ? ? ? ? ? ?offset ?+= ?search.length; ?
          ? ? ? ? ? ?end ?= ?document.cookie.indexOf(";", ?offset); ?
          ? ? ? ? ? ?if ?(end ?== ?-1) ?end ?= ?document.cookie.length; ?
          ? ? ? ? ? ?cookieValue ?= ?unescape(document.cookie.substring(offset, ?end)) ?
          ? ? ? ?} ?
          ? ?} ?
          ? ?return ?cookieValue; ?
          } ?
          alert( ?readCookie("myCookie") ?); ?
          ?
          寫入cookie: ?
          function ?writeCookie(name, ?value, ?hours) ?
          { ?
          ? ?var ?expire ?= ?""; ?
          ? ?if(hours ?!= ?null) ?
          ? ?{ ?
          ? ? ? ?expire ?= ?new ?Date((new ?Date()).getTime() ?+ ?hours ?* ?3600000); ?
          ? ? ? ?expire ?= ?"; ?expires=" ?+ ?expire.toGMTString(); ?
          ? ?} ?
          ? ?document.cookie ?= ?name ?+ ?"=" ?+ ?escape(value) ?+ ?expire; ?
          } ?
          writeCookie("myCookie", ?"my ?name", ?24); ?
          ?
          --------------------------------------------------------------- ?
          ?
          + ?號字符串連接符號 ?
          ?
          至于cookies,請看: ?
          ?
          用 ?COOKIES ?記錄一個人訪問次數的小程序。 ?
          ?
          <script ?language="JavaScript"> ?
          <!-- ?
          var ?caution ?= ?false ?
          function ?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 ?= ?curCookie ?
          ? ? ? ? ? ? ? ?else ?
          ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?if ?(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 ?null ?
          ? ? ? ? ? ? ? ?var ?cookieEndIndex ?= ?document.cookie.indexOf(";", ?cookieStartIndex ?+ ?
          prefix.length) ?
          ? ? ? ? ? ? ? ?if ?(cookieEndIndex ?== ?-1) ?
          ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?cookieEndIndex ?= ?document.cookie.length ?
          ? ? ? ? ? ? ? ?return ?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:01 ?GMT" ?
          ? ? ? ? ? ? ? ?} ?
          } ?
          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 ?= ?1 ?
          else ?
          ? ? ? ? ? ? ? ?visits ?= ?parseInt(visits) ?+ ?1 ?
          setCookie("counter", ?visits, ?now) ?
          document.write("歡迎您第 ?" ?+ ?visits ?+ ?" ?次來到本站點") ?
          // ?--> ?
          </script> ?
          ?
          --------------------------------------------------------------- ?
          ?
          function ?setCookie(name,value) ?
          { ?
          ? ? ?var ?Days ?= ?30; ?
          ? ? ?var ?exp ? ?= ?new ?Date(); ? ? ? ?//new ?Date("December ?31, ?9998"); ?
          ? ? ? ? ? ? ?exp.setTime(exp.getTime() ?+ ?Days*24*60*60*1000); ?
          ? ? ? ? ? ? ?document.cookie ?= ?name ?+ ?"="+ ?escape ?(value) ?+ ?";expires=" ?+ ?exp.toGMTString(); ?
          } ?
          function ?getCookie(name) ?
          { ?
          ? ? ?var ?arr,reg=new ?RegExp("(^ ?| ?)"+name+"=([^;]*)(; ?|$)"); ?
          ? ? ? ? ? ? ?if(arr=document.cookie.match(reg)) ?return ?unescape(arr[2]); ?
          ? ? ? ? ? ? ?else ?return ?null; ?
          } ?
          function ?delCookie(name) ?
          { ?
          ? ? ?var ?exp ?= ?new ?Date(); ?
          ? ? ? ? ? ? ?exp.setTime(exp.getTime() ?- ?1); ?
          ? ? ?var ?cval=getCookie(name); ?
          ? ? ? ? ? ? ?if(cval!=null) ?document.cookie= ?name ?+ ?"="+cval+";expires="+exp.toGMTString(); ?
          }??
          posted on 2006-07-31 13:21 SIMONE 閱讀(209) 評論(0)  編輯  收藏

          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 肇源县| 铜梁县| 肥西县| 崇文区| 百色市| 迁西县| 驻马店市| 定陶县| 清新县| 射阳县| 大洼县| 七台河市| 垦利县| 商河县| 富阳市| 桓台县| 额济纳旗| 敖汉旗| 思茅市| 鹤壁市| 上犹县| 囊谦县| 盐源县| 徐汇区| 城口县| 土默特右旗| 卢龙县| 石狮市| 呼图壁县| 江津市| 白沙| 潮安县| 涿鹿县| 富阳市| 县级市| 兰州市| 和顺县| 灯塔市| 娄烦县| 晋城| 化德县|