How to Create a Button in Web –in HTML

Spread the love

Button is an important aspect of website.Rather in client side button is the heart of webpage. Basically it triggers any action. it is very important to learn the functionality of button.So a button is a graphical representation of trigger point of an HTML page.

This article is mainly for automation test engineers who work on button object.

Let us understand how the developers create a button.

<input type=”button”/>

Well this is enough to create a button. This is how the button will look like.

let us do little more.. let us give it a name..I am creating a button with a name “button1” and display for user will be Click me.

<html>
 <head>
 <title> Testing button </title>
  </head>
 <body>
 <form name=”form1″>
 <input type=”button” name=”button1″ value=”Click me”/>
</form>
</body>
</html>

The output will be..

Let us understand the argument and properties of a button

TypeItem
Details
ArgumentsStringWhat shall appear on top of the button
numThis is bit interesting.When there are multiple button with same name then this number becomes handy.Remember descriptive programming , we use index a property to uniquely identify an element.  
PropertiesformThis property is required when form object of the button needs to be passed
namemandate property to uniquely identify a button.it specifies the name attribute
typeThis is required to create a button and specific input to <input> tag. This is always button for button class
valueThis is the string which is seen when a webpage runs
idThis is to set an id for a specific object for a web. We mainly use this feature when we filter a webpage by using getElementbyID

image credit: http://www.dragonartz.net

READ  How to Link to an External JavaScript File??


Spread the love

Leave a Comment

Your email address will not be published. Required fields are marked *