Home > Article > Web Front-end > Three ways to jump to the page by clicking button tags in HTML
Method 1: Use onclick event
<input type="button" value="按钮" onclick="javascrtpt:window.location.href='http://www.baidu.com/'" />
or directly use button tag
<button onclick="window.location.href = 'https://www.baidu.com/'">百度</button>
(recommended tutorial: html tutorial)
Method 2: Wrap an a tag in the button tag
<a href="http://www.baidu.com/"> <button>百度</button> </a>
or use
<a href="http://www.baidu.com/"><input type="button" value='百度'></a>
Method 3: Use JavaScript function
<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>
More For programming-related content, please pay attention to the Introduction to Programming column on the php Chinese website!
The above is the detailed content of Three ways to jump to the page by clicking button tags in HTML. For more information, please follow other related articles on the PHP Chinese website!