JavaScript的location对象

来源:互联网 发布:叮当在线客服软件 编辑:程序博客网 时间:2024/05/24 07:23

<html lang="en"><head>    <meta charset="UTF-8">    <title>Title</title>    <script type="text/javascript">        function f1() {            console.log(window.location.href);        }        function f2() {            window.location.href = '24.php';        }    </script>    <style type="text/css">        div {width: 300px; height: 200px; background: lightblue;}    </style></head><body>    <h2>加载事件</h2>    <input type="button" value="获取地址" onclick="f1()">    <input type="button" value="设置地址" onclick="f2()"></body></html>
效果图:




原创粉丝点击