随笔- 10  文章- 1  评论- 31 
在WEB应用中,通常会用到页面的跳转,那么就可以用到javascript中的这两个对象。

1.Location
Location.href 返回整个当前url,若对其赋值:location.href="http://www.sina.com.cn"则跳转其url
location.host 返回域名和端口号,如:www.sina.com.cn:80
lcation.hostname 返回域名
location.port 返回端口
location.pathname 返回域名后第一个斜框后的字符串
location.hash 跳到本页的某个锚
location.search 取url?后的部分

2.History
history.back()    等同于按浏览器的后退按钮
history.forward()  等同于按浏览器的前进按钮
history.current   指当前的url(等同于location.href), 在历史中的索引位置总为 0
history.go(-2)或 history.go("任意.html") 向前或向后移动, 或查找字符串标明的最新url
 posted on 2008-03-26 12:02 somesongs 阅读(160) 评论(0)  编辑 收藏 所属分类: Html\javascirpt\css

标题  
姓名  
主页
Email (只有博主才能看到) 
验证码 *  看不清,换一张 [登录][注册]
内容(请不要发表任何与政治相关的内容)  
  登录  使用高级评论  新用户注册  返回页首  恢复上次提交