Thursday, January 2, 2014

Forms>> HTML Button Tag - (PART_30)

Topic:

How to create a button in html page?
How to make the button disabled?
How to use image as a button?

Explanation:

Button

Example Code:
<form name=myform>
<input type="button" name=myButton value="HAI">
</form>


Result:

HAI

Top of Form
Bottom of Form

Definition:
Here we define the button using "input" tag. we give a attribute called "TYPE=BUTTON" in the tag which defines the type as a button. The attribute name may be defined. The value which we want to be displayed in the button should be given using the attribute "value"( e.g: value=HAI)
 


Non Editable / Un Clickable / Disabled Button
To disable a form button is very simple. We can make a button non editable or un clickable (i.e user cant edit the filed) using the entry "disabled".
 

Example Code:
<input type="button" name=myButton value="disable" disabled>

Result:

disabled



Top of Form
Bottom of Form

Image Button
We can make a image as a button using the attribute "type=image" in input tag.
 

Example Code:
<input type="image" name=myImgButton src="./test.jpg" width=50 height=20>

Result: