close

 

---
location.replace -- 设置当前文档的URL,并且在history对象的地址列表中移除这个URL
  • replace,中文"替换"的意思
  • 引用网址:http://www.dreamdu.com/javascript/location.replace/

replace函数语法

location.replace(url);

replace函数参数

  • url -- URL

replace函数说明

replace函数在设置URL方面与location的href属性或assign函数完全一样,但是它会删除history对象的地址列表中的URL,从而使go或back等函数无法导航。

示例

<input type="button" value="点击按钮定位到梦之都" onclick="location.replace('http://www.dreamdu.com/');">

JavaScript replace() 函数示例 -- 可以尝试编辑

延伸阅读

 

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 dizzy03 的頭像
    dizzy03

    碎碎念

    dizzy03 發表在 痞客邦 留言(0) 人氣()