日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > MAC >内容正文

MAC

html页面点击按钮实现页面跳转功能(html 点击)

發(fā)布時間:2023/11/22 MAC 56 博士
生活随笔 收集整理的這篇文章主要介紹了 html页面点击按钮实现页面跳转功能(html 点击) 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

html頁面點擊按鈕實現(xiàn)頁面跳轉(zhuǎn)

方法1、在button標簽外嵌套一個a標簽,利用超鏈接進行跳轉(zhuǎn);

<a  target="_blank">
?<button>進入baidu首頁</button>
</a>

方法2、在button標簽中添加οnclick="window.location.href=‘頁面url’"代碼,使用onclick事件進行跳轉(zhuǎn)。

<button onclick="window.location. target="_blank"">進入baidu首頁</button>

html頁面自動跳轉(zhuǎn)方法

1.使用meta元素

<meta http-equiv="refresh" content="5;url=hello.html">

http-equiv=“refresh” 是刷新頁面,5秒后執(zhí)行刷新操作,url是跳轉(zhuǎn)的目的頁面地址。

<meta http-equiv="refresh" content="5">

這行代碼的意思是只刷新,不跳轉(zhuǎn)。

2.使用script代碼

立即跳轉(zhuǎn)到hello.html頁面。

<script type="text/javascript">
?? ?window.location.href = 'hello.html';
</script>

或者

<script language="javascript">
?? ?location.replace("http://www.baidu.com/");
</script>

5秒后跳轉(zhuǎn)到hello.html頁面。

<script type="text/javascript">
?? ?setTimeout("window.location.href = 'hello.html'", 5000);
</script>

3.判斷是否手機端

<script type="text/javascript">
var wapurl = window.location.pathname;?
if
?? ?(/Android|webOS|iPhone|iPod|BlackBerry|Windows CE|Windows Phone/i.test(navigator.userAgent))
{if
?? ?(window.location.href.toLowerCase().indexOf("?pc")<0)
{try
?? ?{window.location.href="/wap"+wapurl}
?? ?catch(e){}}
?? ?}
</script>

到此這篇關(guān)于html頁面點擊按鈕實現(xiàn)頁面跳轉(zhuǎn)的文章就介紹到這了,更多相關(guān)html點擊按鈕跳轉(zhuǎn)頁面內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

總結(jié)

以上是生活随笔為你收集整理的html页面点击按钮实现页面跳转功能(html 点击)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。