• cookie


     1 <a href="http://www.baidu.com">我要连接到百度!</a>
     2     <iframe src="" frameborder="0"></iframe>
     3 
     4     <form action="http://game.g.pptv.com/user" method="get" target="http://game.g.pptv.com/user">
     5           <p>First name: <input type="text" name="fname" /></p>
     6           <p>Last name: <input type="text" name="lname" /></p>
     7           <input type="submit" value="Submit" />
     8     </form>
     9     <script type="text/javascript" src="http://static.vas.pptv.com/vas/global/jquery/v_20121107163320/jquery-1.7.2.min.js"></script>
    10     <script type="text/javascript">
    11     $(function(){
    12 
    13         console.log(encodeURI("http://www.w3school.com.cn/My first/"));// URL 是 URI 的一种
    14         console.log(escape("http://www.w3school.com.cn/My first/"));//escape 方法返回一个包含了 charstring 内容的字符串值( Unicode 格式)。所有空格、标点、重音符号以及其他非 ASCII 字符都用 %xx 编码代替,其中 xx 等于表示该字符的十六进制数。例如,空格返回的是 “%20″ 。
    15 
    16         function getCookie(c_name){
    17             var cookie = document.cookie;
    18             if(cookie.length > 0){    // 却确保 cookie 的存在
    19                 var c_start = cookie.indexOf(c_name + "=");
    20 
    21                 if(c_start !== -1){    //再确保c_name 属性存在
    22                     c_start += c_name.length + 1;
    23                     c_end = cookie.indexOf(";", c_start); // indexOf()有两个参数,第一个表示要搜索的,第二个表示开始搜索的位置(包含)
    24 
    25                     if(c_end === -1){
    26                         c_end = cookie.length;
    27                     }
    28 
    29                     return unescape(cookie.substring(c_start, c_end));
    30                 }
    31             }
    32             return "";
    33         }
    34 
    35         function setCookie(c_name, value, expireDays){
    36             var exdate = new Date();
    37             exdate.setDate(exdate.getDate() + 30);
    38             /*var cc = c_name + "=" + escape(value) + (expireDays === null ? "" : ";" + exdate.toGMTString());
    39             console.log(cc);*/
    40             document.cookie = c_name + "=" + escape(value) + (expireDays === null ? "" : ";" + exdate.toGMTString());
    41             console.log(document.cookie);
    42         }
    43 
    44         setCookie("user", "周晶晶", "2");
    45 
    46         /*setCookie : function(name, value, expires){
    47             var now  = new Date(); 
    48 
    49             now.setTime(+now + expires * 24 * 60 * 60 * 1000);  
    50             document.cookie = name + "=" + escape(value) + "; expires=" + now.toGMTString() + ";path=/;domain=pptv.com;";  
    51         },
    52 
    53         removeCookie : function(name){
    54             var now = new Date(), value = this.getCookie(name);   
    55             now.setTime(now.getTime() - 1); 
    56 
    57             if(value){
    58                 document.cookie = name + "=" + value + "; expires=" + now.toGMTString();
    59             };  
    60         },*/
    61 
    62         var $a = $("a");
    63         var $iframe = $("iframe");
    64         //$a.click();
    65         //window.location = $a[0].href;
    66 
    67 
    68         $iframe[0].src = "h1.html";
    69 
    70         //$("input[type=submit]").click();
    71         //window.location = $("form")[0].target;
    72 
    73         document.cookie = "username=sophia_2013";
    74         console.log(111);
    75     });
    76     document.cookie = "username=sophia_zhou";
    77 
    78     var a = 1;
    79     </script>
    疯癫不成狂,有酒勿可尝;世间良辰美,终成水墨白。
  • 相关阅读:
    Python 爬虫js加密破解(一) 爬取今日头条as cp 算法 解密
    Python 爬虫实例(2)—— 爬取今日头条
    Python 爬虫实例(1)—— 爬取百度图片
    python 操作redis之——HyperLogLog (八)
    python 操作redis之——有序集合(sorted set) (七)
    Python操作redis系列之 列表(list) (五)
    Python操作redis系列以 哈希(Hash)命令详解(四)
    Python操作redis字符串(String)详解 (三)
    How to Install MySQL on CentOS 7
    Linux SSH远程文件/目录 传输
  • 原文地址:https://www.cnblogs.com/chuyu/p/3363994.html
Copyright © 2020-2023  润新知