window.open(url, , width=600,height=400);
The second parameter: _self, opens the window in the current window; _blank (default value), opens a new window in another new window;
window.location.href=http://www.vevb.com; //Open the window in the same current window window.history.back(-1); //Return to the previous page<a href=http://www .baidu.net target=_blank>HTML parameter passing: 1. URL parameter passing:
The first page (a.html):
var obj = a.value; //Pass to the pop-up page parameters var url = 'jxb.html?obj='+obj;url = encodeURI(url);window.open(url, , width=600,height=400) ;
The second page (b.html):
var url = decodeURI(window.location.href);var argsIndex = url .split(?obj=);var arg = argsIndex[1];
Note: Chinese transmission: You can use encodeURI to encode the url on page a and use decodeURI to decode the url on page b.
2. Cookie parameters:function setCookie(cname,cvalue){ document.cookie = cname + = + cvalue;} function getCookie(cname){ var name = cname + =; var ca = document.cookie;}3. Pass parameters of localStorage object:
a.html:
var div = doucment.getElementById('The DIV ID name of the string to be obtained'); localStorage.string = div.textContent;
b.html:
var div = doucment.getElementById('The DIV ID name to be written');div.textContent = localStorage.string;4. window.opener()
Parent page:
<input type=text name=textfield id=textfield/>
window.open(subpage.html);
Subpage:
window.opener.document.getElementByIdx('textfield').value='123123123';Summarize
The above is the problem of HTML page jump and parameter transmission introduced by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for your support of the VeVb martial arts website!