here's how to
jump :Method One: window.location.href = "b.html"; method two (return to the previous page, this should not be counted, first put here):Window.history.back ( -1);Method Three: Self.location = "b.html"; method four: Top.location = "b.html"; thinking about the question: first, Why give window.location and window.location.href the same value, can jump? Thinking:Location is Location.href's simplicity, whether it's an interview or
a value. From the function, location and so on Location.href;But from this theory, location is an image, and Location.href is one of its own. This weird line is supposed to be compatible.second, when assigning a value to a location, if the page is not in the same directory, you need to write the full URL. For example: The current location.href ishttps://www.google.com/, if you want to jump to https://www.baidu.com/, you cannot just www.baidu.com, you must write the URL complete.
Pass ValueThe method is as follows: Method one: url parameter (? The following parameters) (where to go to the net pen question, the URL after the argument to resolve to the object) Window.location.href = "Https://www.google.com/search?Q=hello&oq=hello "function parseURL (URL) {var url = url.split ("? ") [1]; var para = url.split ("&"); var len = para.length; var res = {}; var arr = []; for (Var i=0;i<len;i++) {arr = para.split ("="); Res[arr[0]] = arr[1]; } return res; Method Two: The cookie passes the parameterfunction Setcookie (cname,cvalue,exdays) {var d = new Date ();D.settime (D.gettime () + (exdays*24*60*60*1000));var expires = "expires=" + d.toutcstring ();Document.cookie = cname + "=" + Cvalue + ";" + expires;}
function GetCookie (CNAME) {var name = cname + "="; var CA = Document.cookie.split (";"); for (Var i=0;i<ca.length;i++) {var c = ca[i]; while (C.charat (0) = = ") {c = c.substring (1); } if (C.indexof (CNAME) = = 0) {return c.substring (name.length,c.length); }} return "";} Method Three: The Localstorage object in the Web Storage in H5
Localstorage.setitem ("LastName", "Lu"), or Localstorage.lastname = "Lu";
Localstorage.getitem ("LastName"); or localstorage.lastname;
Jump and transmit values between HTML pages (JS code)