W3School TIY
编辑您的代码:
<html> <head> <script type="text/javascript"> function currLocation() { alert(window.location) } function newLocation() { window.location="../index.html"/*tpa=http://www.jb51.net/index.html*/ } </script> </head> <body> <input type="button" onclick="currLocation()" value="显示当前的 URL"> <input type="button" onclick="newLocation()" value="改变 URL"> </body> </html>
查看结果: