JS history(一)返回上一页

来源:互联网 发布:c语言中的指针是什么 编辑:程序博客网 时间:2024/06/05 05:45
<!DOCTYPE html><html>  <head>    <title>javascript01.html</title>    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">    <meta http-equiv="description" content="this is my page">    <meta http-equiv="content-type" content="text/html; charset=UTF-8">    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->    <script type="text/javascript">        console.log('测试history and location');        function fn1(){        //获取表单元素的值用value,获取其他节点的中的内容用innerHTML            var href = document.getElementById('ipt').value;            window.location.href = href;        }    </script>  </head>  <body>    <a href="js06_historyBack.html">js06</a><br/>    <a href="#" onclick="fn1()">testLocation</a><input type="text" id="ipt" />  <!-- window.location.href  的href不是一个方法不可以写在onclick=""中,是一个属性,可以通过方法来实现 -->  </body></html>