欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

  發(fā)布時間:2023-07-13 16:44:18   作者:Hi~晴天大圣   我要評論
這篇文章主要介紹了html頁面點擊按鈕實現(xiàn)頁面跳轉(zhuǎn)功能,本文通過實例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下

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

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

<a  target="_blank">
?<button>進(jìn)入baidu首頁</button>
</a>

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

<button onclick="window.location. target="_blank"">進(jìn)入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.判斷是否手機(jī)端

<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)文章,希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論