javascript实现cookies的查询代码实例

javascript实现cookies的查询代码实例

<script language="javascript">
    <!--
       var cookies = document.cookie;
       function readcookie(name) {
          var start = cookies.<a href="http://www.3ppt.com/tags.php/indexof">indexof</a>(name + "=");
          if (start == -1){
              alert("cookie not found");
          }
          start = cookies.indexof("=", start) + 1;
          var end = cookies.indexof(";", start);
          if (end == -1){
              end = cookies.length;
          }
          var value = unescape(cookies.substring(start, end));
          if(value == null){
            alert("no cookie found");
          } else{
            alert("cookie value is: " + value);
          }
       }
       readcookie("www.3ppt.com");
    -->
    </script>

posted on 2011-05-07 10:26  志向不在北京  阅读(285)  评论(0编辑  收藏  举报

导航