banner



How To Create A Button Link In Html


Hyper Linking buttons in webpage Hyper links are used to link different pages within a site and outside a site to each other. Same thing can be achieved by using a button. We can use a button to link different pages. We will connect the url of the new page to the onclick event of the button. We can do this by using a form and a submit button but there is no point in using a form for a hyper linking of pages. So here are some examples of using buttons to link different pages.

HTML button with onClick event with location to link between web pages using address or URLs


Video tutorial on Text links in Part I
              <input type=button onClick="parent.location='index.html'"  value='click here'>            

Another way of linking button

              <input type=button onClick="location.href='index.html'"  value='click here'>            

Demo of two types of buttons with code

              <input type=button onClick="location.href='../'"  value='click here to visit home page'>            

              <input type=button onClick=" parent.location='https://www.plus2net.com/'"  value='click here to visit home page'>            

Using hyper link

              <a href=../><input type=button value='HOME'></a>            
Some time from SEO angle linking using a button is not a good idea as we loose the anchored text advantage of hyper linking. Read the article on search engine friendly page design to know more on this.

Opening in a new window

To open the target page in a new window ( new Tab ) we have to use onClick=parent.open()
              <input type=button onClick="parent.open('https://www.plus2net.com/')"  value='click here to visit home page' >            

Managing from a child window

We can open a child window of different height and width by using JavaScript window.open command. We can pass any variable to child window and receive data from child window to main window.

Read More on Child window control in our JavaScript section.

We can display buttons in Child window and manage the main ( parent ) window by using buttons. We can make the main window navigate to different page from the child window.

Check this demo on using buttons to manage main window.

To display above button , source is here

              <input type=button onClick=window.open("button-child.php","demo","width=550,height=300,left=150,top=200,toolbar=0,status=0,"); value="Open child Window">            
Source code of the buttons used in Child window is here
              <input type=button onClick="opener.location='https://www.plus2net.com/'" value='Make the Main window change'> <input type=button onClick="opener.location='https://www.plus2net.com/html_tutorial/button-linking.php'" value='Bring the button linking tutorial again'> <input type=button onClick="location='https://www.plus2net.com/'" value='Make the current  window change'> <input type=button onClick="self.close();" value="Close this window">                          

Button with Style

We can create attractive buttons by using style property. We can manage shape, size, font , background colour, shadow, hover and many other properties of the button.
DEMO of Buttons with CSS properties

Using bootstrap style

Bootstrap is opensource front end framework to manage look and feel of your website.
We can add attractive buttons using bootstrap classes.

We can change size of these buttons
Read more attractive buttons using bootstrap in JQuery section.

Using image to link

Click this logo ( image ) to visit home page

              <a href="../"><img src=../images/top2.jpg></a>            

target=new

We can open the page in a new tab by using target=new. This can be used in text links and buttons also.
              <a href="../"  target=new><img src=../images/top2.jpg></a>            
HTML
Hyper-linking Submitting a form using Image as button

This article is written by plus2net.com team.

How To Create A Button Link In Html

Source: https://www.plus2net.com/html_tutorial/button-linking.php

Posted by: grissomfrinslazince.blogspot.com

0 Response to "How To Create A Button Link In Html"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel