Is there a hyperlink to the HTML button tag? This has the button tag set instance of the hyperlink

Source: Internet
Author: User
This article is mainly about the HTML button tag of the hyperlink added to the method, there are examples and explanations. Next, let's take a look at this article about HTML button tag plus hyperlink.

First, let's see if the HTML button tag has a hyperlink:

Take a look at an example

<input type= "button" value= "register" onclick= "window.location.href= ' http://www.php.cn '" >

This effect is obvious, display a button on the webpage, click will jump to the target link. So the button tag roommate hyperlink, but this is not the most common use of button tags.

Now let's take a look at the explanation of the button tag to add a hyperlink:

If you want to turn this page to a new screen, use: <input type=button onclick= "window.location.href (' Connection ')" >

If you need to open a new page for steering, use: <input type=button onclick= "window.open (' Connection ')" > Note: The above button plus hyperlink is only useful for IE. Firefox and Safari can use the following methods if they want to work together:

<a href= "link" ><input Type=button onclick= "window.location.href (' Connection ')" > </a>

A hyperlink is an element that allows a page to connect to another page or site, which is part of a Web page. According to the use of different objects, the super-chain can be divided into: text hyperlinks, image hyperlinks, e-mail links, anchor links, multimedia file links, empty links and so on.

The destination of a hyperlink can be another page, a different location on the same page, a picture, an e-mail address, a file, or even an application. The object that is used to hyperlink in a Web page can be a piece of text or a picture. When a viewer clicks a text or picture that has been linked, the link target is displayed on the browser and is opened or run depending on the type of target.

Reference code:

<a href= "link" ><input Type=button onclick= "window.location.href (' Hyper connect Address ')" > </a>

Code Description: The onclick event occurs when the object is clicked.

Please note that the onclick is different from onmousedown. Click event occurs when a mouse-down event occurs after a mouse-down event occurs on the same element.

window.location.href= "Jump Address"; Indicates a redirect to a new page, while refreshing the open page;

Several ways to use HTML button label plus hyperlinks:

1. The page turns to a new page:

<input type= "button" onclick= "window.location.href (' Connection ')" >

2. A new page needs to be opened for steering:

<input type= "button" onclick= "window.open (' Connection ')" >

Because the kernel of our browser is different, like the following two, they are not the same usage

Used in 3.IE:

<input type= "button" name= "Test" value= "test" onclick= "location.href= ' a.html '"/>

Used in 4.firefox:

<a href= "b.html" ><input type= "button" name= "Test" value= "test"/></a>
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.