您好,登錄后才能下訂單哦!
小編給大家分享一下HTML怎么實(shí)現(xiàn)點(diǎn)擊button頁(yè)面跳轉(zhuǎn),希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
方法:1、使用onclick事件,在標(biāo)簽內(nèi)添加“onclick="window.location.href=地址"”即可;2、在button標(biāo)簽外套一個(gè)a標(biāo)簽,在a標(biāo)簽中用href屬性添加跳轉(zhuǎn)代碼。
本教程操作環(huán)境:windows7系統(tǒng)、CSS3&&HTML5版、Dell G3電腦。
方法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> -->
看完了這篇文章,相信你對(duì)“HTML怎么實(shí)現(xiàn)點(diǎn)擊button頁(yè)面跳轉(zhuǎn)”有了一定的了解,如果想了解更多相關(guān)知識(shí),歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!
免責(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)容。