1. Use of cookies
<script src= "Http://code.jquery.com/jquery-1.9.0.min.js" ></script><script src= "./jquery.cookie.js "></script><script> //This setting is one by one corresponding to the default cookie scope for the current folder under $.cookie (" Favourite-city "," London "); $.removecookie ("favourite-city"); Set the cookie $.cookie ("favourite-city", "London", {path: "/", Domain: "test.com"}); $.removecookie ("Favourite-city ", {path:"/", Domain:" test.com "}); Gets the cookie variable $.cookie ("favourite-city");//Set expiration date var date = new Date (), var m = 6;//minutesdate.settime ( Date.gettime () + (M * +)); $.cookie (Key,value, {expires:date});//or $.cookie ("favourite-city", "", {expires:new date (+, +,-one, XX, xx), sec Ure:true});</script>
2. Get parameter of URL address
<script>/** * Gets the Get parameter on the URL */function geturlparameter (sParam) { var spageurl = Window.location.search.substring (1); var surlvariables = spageurl.split (' & '); for (var i = 0; i< surlvariables.length; i++) { var sparametername = surlvariables[i].split (' = '); if (sparametername[0] = = SParam) { return sparametername[1] ; }} /* Use example */var tech = Geturlparameter (' technology '), var blog = geturlparameter (' blog '), alert (tech); alert (blog); </ Script>
JS Object-Oriented Learning note eight (cookie used with URL get parameter gets)