关于JavaScript的location对象的使用
2015-10-10 10:59
746 查看
代码示例如下:
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus?"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>location对象</title> </head> <script type="text/javascript"> <!-- /* 掌握:1 href属性 2. reload()方法:重新加载本页面 */ function fun(){ //window.location.href = "history对象/b.html" ; //假设b.html文件在你当前目录下的history对象的文件夹下, //那么通过这条语句,可以直接跳转到b.html页面 window.location = "b.html" ; //作用同上,只是两种不同的写法 } function fun1(){ window.location.reload(); //重新加载本页面 } //--> </script> <body> <input type="button" value="直接去b.html" onclick="fun()"> <input type="button" value="重新加载本页面" onclick="fun1()"> </body> </html>
相关文章推荐
- 关于JavaScript的鼠标移动事件
- 关于JavaScript的history对象的方法的使用
- 关于JavaScript的数组
- 关于JavaScript的window对象的计时器
- 关于JavaScript的String及Math对象的方法的使用
- 关于JavaScript的window对象的open和close方法
- 关于JavaScript的window对象的三种对话框
- 关于JavaScript的window对象的opener及parent属性
- 关于JavaScript的window对象的status属性
- JS类的封装及实现代码【转】
- 关于JavaScript的几种常见的全局函数
- 关于JavaScript的函数劫持
- 关于JavaScript的函数定义及调用
- JavaScript的数据类型,运算符及数据类型之间的转化
- JavaScript与html的结合方式
- JSP&Servlet学习笔记(一)
- js克隆对象
- js 字符串转换成数字的三种方法
- javascript知识详解之8张思维导图
- javascript知识详解之8张思维导图