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

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

  發(fā)布時間:2023-07-13 16:44:18   作者:Hi~晴天大圣   我要評論
這篇文章主要介紹了html頁面點擊按鈕實現(xiàn)頁面跳轉(zhuǎ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)文章,希望大家以后多多支持腳本之家!

相關(guān)文章

最新評論

阿克陶县| 七台河市| 栾川县| 云阳县| 柳河县| 开原市| 嵊泗县| 天祝| 武宣县| 团风县| 东阳市| 盐津县| 富裕县| 澄迈县| 龙胜| 武乡县| 万山特区| 板桥市| 财经| 祁连县| 登封市| 镇宁| 宣城市| 阿城市| 龙山县| 延津县| 沾化县| 瑞安市| 蒲城县| 岳阳县| 阜南县| 邢台市| 华亭县| 平湖市| 泾源县| 富裕县| 荥经县| 南康市| 白水县| 五常市| 新兴县|