Home  >  Article  >  Web Front-end  >  How to click the button to jump to the page in html

How to click the button to jump to the page in html

青灯夜游
青灯夜游Original
2021-05-14 17:23:0182672browse

htmlHow to click a button to jump to the page: 1. Nest an a tag outside the button tag and use a hyperlink to jump; 2. Add "onclick="window.location.href" to the button tag ='page url'"" code, use onclick event to jump.

How to click the button to jump to the page in html

The operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.

Method 1: Coat an a label with the button label

<a href="https://www.php.cn/">
	<button>进入PHP中文网</button>
</a>

Rendering:

How to click the button to jump to the page in html

##Method 2: Use onclick event

<button onclick="window.location.href = &#39;https://www.php.cn/&#39;">进入PHP中文网</button>

Rendering:


How to click the button to jump to the page in html

Recommended tutorial: "

html video tutorial

The above is the detailed content of How to click the button to jump to the page in html. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn