html按鈕如何設置超鏈接?這個問題可能是我們日常學習或工作經常見到的。希望通過這個問題能讓你收獲頗深。下面是小編給大家帶來的參考內容,讓我們一起來看看吧!
html按鈕設置超鏈接的方法一:使用超鏈接與button結合的方法
html按鈕超鏈接代碼如下:
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <a href="http://www.php.cn/"> <input type=button value="億速云" > </a> </body> </html>
說明:<a> 標簽的 href 屬性用于指定超鏈接目標的URL。
html按鈕設置超鏈接的方法二:使用鏈接和css樣式設置將超鏈接設置成按鈕的形狀
html按鈕超鏈接代碼如下:
<!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> a.button { -webkit-appearance: button; -moz-appearance: button; appearance: button; text-decoration: none; color: initial; } </style> </head> <body> <a href="http://www.php.cn" class="button">億速云</a> </body> </html>
html按鈕設置超鏈接的方法三:使用 form表單來設置html按鈕超鏈接
html按鈕超鏈接代碼如下:
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <form method="get" action="http://www.php.cn/"> <button type="submit">億速云</button> </form> </body> </html>
html按鈕設置超鏈接的方法四:使用window.location.href方法
完整的寫法:
<a href="鏈接"> <input type=button onclick="window.location.href('連接')"> </a>
說明:
1、若直接在本頁跳轉到新的頁面,則用: <input type=button onclick="window.location.href('連接')">
2、如果需要打開一個新的頁面進行跳轉,則用: <input type=button onclick="window.open('連接')">
感謝各位的閱讀!看完上述內容,你們對html按鈕如何設置超鏈接大概了解了嗎?希望文章內容對大家有所幫助。如果想了解更多相關文章內容,歡迎關注億速云行業資訊頻道。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。