html文件里怎样改变当前网址,就是,我在html里放1个按钮,一点按钮,就改变当前网页的网址

html文件里怎样改变当前网址,就是,我在html里放1个按钮,一点按钮,就改变当前网页的网址,第1张

你加个连接就好了。例如你的按钮是button,你就做一个连接把它只想你要得网址

1.如果让本页转向新的页面则用:

<input type=button onclick="window.location.href('连接')">

2.如果需要打开一个新的页面进行转向,则用:

<input type=button onclick="window.open('连接')">

JS

  url = window.location.href

function GetUrlPara()

{

var url = document.location.toString()

var arrUrl = url.split("?")

var para = arrUrl[1]

return para

}

url = document.domain

用JS获取当前页面地址

<script language="javascript">

alert(window.location.href)

alert(window.location)

alert(location.href)

alert(parent.location.href)

alert(top.location.href)

alert(document.location.href)

alert(document.URL)

alert(document.title)

</script>


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/7417325.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-05
下一篇 2023-04-05

发表评论

登录后才能评论

评论列表(0条)

保存