溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶(hù)服務(wù)條款》

html中如何通過(guò)點(diǎn)擊button標(biāo)簽實(shí)現(xiàn)頁(yè)面跳轉(zhuǎn)

發(fā)布時(shí)間:2020-04-23 13:53:39 來(lái)源:億速云 閱讀:1166 作者:小新 欄目:web開(kāi)發(fā)

本篇文章和大家了解一下html中如何通過(guò)點(diǎn)擊button標(biāo)簽實(shí)現(xiàn)頁(yè)面跳轉(zhuǎn)。有一定的參考價(jià)值,有需要的朋友可以參考一下,希望對(duì)大家有所幫助。

html中如何通過(guò)點(diǎn)擊button標(biāo)簽實(shí)現(xiàn)頁(yè)面跳轉(zhuǎn)

方法1:使用onclick事件

<input type="button" value="按鈕"
onclick="javascrtpt:window.location.href='http://www.baidu.com/'" />

或者直接使用button標(biāo)簽

<button onclick="window.location.href = 'https://www.baidu.com/'">百度</button>

方法2:在button標(biāo)簽外套一個(gè)a標(biāo)簽

<a href="http://www.baidu.com/">
    <button>百度</button>
</a>

或使用

<a href="http://www.baidu.com/"><input type="button" value='百度'></a>

方法3:使用JavaScript函數(shù)

<script>
function jump(){
 window.location.href="http://www.baidu.com/";
}
</script>
<input type="button" value="百度" onclick=javascrtpt:jump() />
// 或者<input type="button" value="百度" onclick="jump()" />
// 或者<button onclick="jump()">百度</button>

以上就是html中如何通過(guò)點(diǎn)擊button標(biāo)簽實(shí)現(xiàn)頁(yè)面跳轉(zhuǎn)的簡(jiǎn)略介紹,當(dāng)然詳細(xì)使用上面的不同還得要大家自己使用過(guò)才領(lǐng)會(huì)。如果想了解更多,歡迎關(guān)注億速云行業(yè)資訊頻道哦!

向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI