<!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>
JS history(一)返回上一页
最新推荐文章于 2024-09-24 08:45:00 发布