HTML page jump: window.open(url, "", "width=600,height=400"); The second parameter: _self, opens the window in the current window; _blank (default value), opens the new window in another new window; window.location.href="https://www.jb51.net"; //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 pop-up page parameter 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: For Chinese transmission: you can use encodeURI to encode the URL on page a and decodeURI to decode the URL on page b. 2. Cookie parameter transmission: function setCookie(cname,cvalue){ document.cookie = cname + "=" + cvalue; } function getCookie(cname){ var name = cname + "="; var ca = document.cookie; } 3. localStorage object parameter passing: a.html: var div = doucment.getElementById('DIV ID name to get the string'); localStorage.string = div.textContent; b.html: var div = doucment.getElementById('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"); Subpages: window.opener.document.getElementByIdx('textfield').value='123123123'; Summarize The above is the editor's introduction to HTML page jump and parameter passing issues. I hope it will be helpful to everyone. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! |
<<: The difference between absolute path and relative path in web page creation
>>: Implementation of new issues of CSS3 selectors
I have just started using react to do projects, a...
Preface Recently, I have been helping clients con...
Preface In WeChat applet, you can use globalData ...
Table of contents 1. Problem Discovery 2. View de...
Table of contents Brief Introduction setInterval ...
The Truncate table statement is used to delete/tr...
Focus images are a way of presenting content that ...
Table of contents A chestnut to cover it Paramete...
Sometimes we want to implement such a function: c...
MySQL master-slave configuration and principle, f...
Table of contents 1. Animated Christmas Tree Made...
Preface Students who learn JavaScript know that A...
1. Native network request 1. XMLHttpRequest (w3c ...
Table of contents 01 sql_slave_skip_counter param...
Table of contents Preface Is there any hope after...