HTML 傳 參數 [透過JavaScript讓HTML頁面互相傳值](HTML Send Var)
HTML 傳 參數 [透過JavaScript讓HTML頁面互相傳值](HTML Send Var)
資料來源:
01. https://cyfangnotepad.blogspot.com/2013/09/javascripthtml.html
02. https://blog.csdn.net/csdn_ds/article/details/78393564
GITHUB: https://github.com/jash-git/HTML-Send-Var
01.html
<html> <head> <meta charset="utf8"> <title>測試1</title> </head> <body> <button onclick='location.href="02.html?a=b&b=c&c=d"'> One </button> </body> </html>
02.html
<html> <head> <meta charset="utf8"> <title>測試2</title> <script type="text/javascript"> function show () { //URL var url = location.href; //取得問號之後的值 var temp = url.split("?"); //將值再度分開 var vars = temp[1].split("&"); //一一顯示出來 for (var i = 0; i < vars.length; i++) { alert(vars[i]); }; } </script> </head> <body> <button onclick="show()"> two </button> </body> </html>