最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

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

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

方法1、在button標(biāo)簽外嵌套一個(gè)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頁面自動(dòng)跳轉(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頁面點(diǎn)擊按鈕實(shí)現(xiàn)頁面跳轉(zhuǎn)的文章就介紹到這了,更多相關(guān)html點(diǎn)擊按鈕跳轉(zhuǎn)頁面內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

大连市| 罗山县| 鹿泉市| 阿勒泰市| 山阳县| 龙陵县| 招远市| 登封市| 石首市| 铜川市| 通化县| 孟州市| 海丰县| 芷江| 临邑县| 新宾| 霍城县| 土默特左旗| 衡山县| 马公市| 吴江市| 花莲县| 墨江| 泰顺县| 游戏| 罗甸县| 肥乡县| 潼关县| 湘阴县| 千阳县| 桃源县| 军事| 孟连| 庆安县| 黔江区| 松江区| 罗江县| 襄樊市| 海南省| 盐津县| 清苑县|