


In html, sometimes you may need to set a button hyperlink for good looks and convenience. So how to set a hyperlink for an html button? Next, in this article, we will take a look at the four implementation methods of html button hyperlinks. Friends in need can refer to them.
Method 1 for setting hyperlinks on html buttons: Using the method of combining hyperlinks with buttons
html button hyperlinksConnectionThe code is as follows:
<!DOCTYPE html> <html> <head> <title></title> </head> <body> <a href="http://www.php.cn/"> <input type=button value="php中文网" > </a> </body> </html>
html button hyperlinkThe effect is as follows:
Method 2 for html button to set hyperlink: Use link and css style settings to set the hyperlink into the shape of button
html button hyperlink code is as follows :<!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">php中文网</a> </body> </html>
Method 3 for setting hyperlinks on html buttons: Use form form to set html button hyperlinks
html button hyperlink code is as follows:<!DOCTYPE html> <html> <head> <title></title> </head> <body> <form method="get" action="http://www.php.cn/"> <button type="submit">php中文网</button> </form> </body> </html>
Method 4 for setting hyperlinks on html buttons: Use the window.location.href method
Complete writing method:<a href="链接"> <input type=button onclick="window.location.href('连接')"> </a>Instructions:
2. If If you need to open a new page to jump, use:
The above is the detailed content of How to set a hyperlink on an html button? Four implementation methods of html button hyperlinks. For more information, please follow other related articles on the PHP Chinese website!

The article discusses the HTML <datalist> element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

The article discusses the HTML <progress> element, its purpose, styling, and differences from the <meter> element. The main focus is on using <progress> for task completion and <meter> for stati

The article discusses the HTML <meter> element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates <meter> from <progress> and ex

The article discusses the <iframe> tag's purpose in embedding external content into webpages, its common uses, security risks, and alternatives like object tags and APIs.

The article discusses the viewport meta tag, essential for responsive web design on mobile devices. It explains how proper use ensures optimal content scaling and user interaction, while misuse can lead to design and accessibility issues.

The article discusses using HTML5 form validation attributes like required, pattern, min, max, and length limits to validate user input directly in the browser.

Article discusses best practices for ensuring HTML5 cross-browser compatibility, focusing on feature detection, progressive enhancement, and testing methods.

This article explains the HTML5 <time> element for semantic date/time representation. It emphasizes the importance of the datetime attribute for machine readability (ISO 8601 format) alongside human-readable text, boosting accessibilit


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft