Document directory
HTML page value passing
Directly transfer values on a page, which can be implemented using a simple script. However, in many cases, we cannot just consider passing values. Not much nonsense,
The values in HTML are as follows:
For general integrity, the following code is used:
R. js
function sub(){var str=""+document.getElementById('area').value;var url="b.html?a="+escape(str);location.href=url;}
A.html and B .html
</Head> <SCRIPT type = "text/JavaScript" src = "R. JS "> </SCRIPT> <body> <textarea name =" area "id =" area "> </textarea> <a href =" ### "onclick =" sub () "> jump </a> </SCRIPT> </body>
B .html
<Body> <textarea name = "area" id = "area"> </textarea> <SCRIPT type = "text/JavaScript"> var loc = location. href; loc = Unescape (LOC); var n1 = loc. length; // The total length of the address var n2 = loc. indexof ("="); // obtain the = position if (N2> 0) {var id = loc. substr (n2 + 1, n1-n2); // The contents after the = Sign document. getelementbyid ("area "). value = ID ;}</SCRIPT> </body>
Transfer within page a.html
</Head> <SCRIPT type = "text/JavaScript" src = "R. JS "> </SCRIPT> <body> <textarea name =" area "id =" text "> </textarea> <textarea name =" area "id =" area "> </textarea> <a href = "####" onclick = "sub () "> jump </a> <SCRIPT type =" text/JavaScript "> var loc = location. href; loc = Unescape (LOC); var n1 = loc. length; // The total length of the address var n2 = loc. indexof ("="); // obtain the = position if (N2> 0) {var id = loc. substr (n2 + 1, n1-n2); // The contents after the = Sign document. getelementbyid ("text "). value = ID ;}</SCRIPT> </body>
r.js
function sub(){var str=""+document.getElementById('area').value;var url="b.html?a="+escape(str);location.href=url;}