Sunday, 24 July 2016

HTML DataList, Progress, Meter Element

DataList Element
It is used to display a list of predefined options. As soon as user starts typing a word a list of option will be shown in the drop down. It is used with the input element, in which the list attribute is specified. The value of list attribute is similar to id attribute of datalist.

example
<!Doctype Html>
<html>
<body>
<h1>Datalist</h1>
<form>
<p>select any general name :</p>
<input type="text" name="generalname" list="general">
<datalist id="general">
<option value="Anti oxidant">
<option value="barium">
<option value="calcium">
<option value="decimal">
<option value="detergent">
</datalist>
</form>
</body>
</html>


Progress Element
It is used to display the progress of a particular task. It can be used with javascript to display the progress.
It has two attribute value and max. value attribute specifies the, how much the task has been completed and the max attribute is used to specify the total progress to be made.

Attributes of Progress Element

  • value- specifies the value of progress element.
  • max- specifies the maximum value of progress element.
example 

<!Doctype Html>
<html>
<body>
<h1>Progress element</h1>
Current progess is
<progress value="200" max="500"
</progress>
</body>
</html>


Meter Element
It is used to define the scalar measurement. It is used to display a range

Attributes of Meter Element
  • value- specifies the value of the meter element.
  • min- specifies the minimum value of meter element.
  • max- specifies the maximum value of the meter element.
  • low- specifies a range that is considered as low value.
  • high- specifies a range that is considered as high value.
  • optimum- specifies a range that is considered as optimum or best value.
  • form- refer to the id of the form element.
example

<!Doctype Html>
<html>
<body>
<h1>Meter element</h1>
<meter value="5" min="0" max="10" style="width="200px"></meter>passing score<br/>
<meter value="8" min="0" max="10" style="width="200px"></meter>your score
</body>
</html>


HTML FieldSet and Legend Element

Fieldset Element
It is used to group related controls in a single box. Suppose you have to show information to user regarding his purchase and his information.
Than you will put his information like Username, Address, phone number etc at one single block and product information in other single block.
By doing this information will look more organized.

Attributes of FieldSet Element

  • disabled- disabled the textarea.
  • id- refers to the name of textarea.
  • form- refers to the id of the form
Legend Element
It is used to provide caption for the fieldset element.

example 1

<!Doctype Html>
<html>
<body>
<h1>Fieldset and Legend Element</h1>
<form>
<Fieldset> 
<legend>
login window
</legend>
<label>
username<input type="text">
</label><br/>
<label>
password<input type="password">
</label><br/>
<label>
<input type="submit" value="click here" name="submit" />
</label>
</fieldset>
</form>
</body>
</html>
example 2: using disabled attribute
<!Doctype Html>
<html>
<body>
<h1>Fieldset and Legend Element</h1>
<form>
<Fieldset disabled> 
<legend>
login window
</legend>
<label>
username<input type="text">
</label><br/>
<label>
password<input type="password">
</label><br/>
<label>
<input type="submit" value="click here" name="submit" />
</label>
</fieldset>
</form>
</body>
</html>


HTML TextArea, Label Element

TextArea Element
This element allows us to enter multiple line of information. It is similar to textbox but textbox allows us to enter in the single line.

Attributes of TextArea

  • cols- refers to the visible width of textarea control.
  • rows- refers to the number of rows in the textarea control.
  • disabled- disabled the textarea.
  • name- refers to the name of the textarea.
  • readonly- specifies that the textarea is read-only and you cannot write in it.
  • accesskey- refers to the shortcut key on the keyboard.
  • autofocus- allows the control too get focus as soon as the page loads.
  • dirname- specifies the name of the input control that indicates the text direction of the textarea.
  • placeholder- helps the user to fill the respective textarea by providing hint for the input.
  • required- specifies that the value of input field is mandatory.
  • wrap- allows the textarea to wrap the text.
Label Element
It allows us to add the description of the control. Each label element is associated with exactly on e control.

Attributes of Label Element
  • for- associates the label with a specific control. the value of this attribute must match the id attribute of its associated control.
  • form- refers to the id of the form.

example

<!Doctype Html>
<html>
<body>
<h1>TextArea and Label Element</h1>
<form>
<label id="lbldescription" for="txtarea">TextArea Description :</label><br/>
<textarea id="txtarea" cols="30" rows="7" wrap="wrap">
This is text Area control. Please 
enter your multiline text here.
It is different from textbox because it 
allows multine text to be entereed.
</textarea>
</form>
</body>
</html>


HTML Button Element

Button Element
It is used to add button control on the form. Button can be used to perform various task such as submitting or resetting the details of the form elements.
Button control can placed in the form using the Input element, but you cannot change the appearance of the button in this case.
If button is created using button element than we can change the appearance of the button.
The text, images, multimedia embedded between the opening and closing tag of the button element become the content of the button element.
The button element provides type attribute that allows you to create three type of button

  • submit
  • reset
  • normal
submit is used for submitting the form, reset for erasing all the data from the form.
we can create submit button by setting type attribute submit, reset button by setting type attribute reset and normal button by setting type attribute button.

Attributes of Button Element
  • autofocus- allows the button control to get the focus as soon as the page loads.
  • disabled- disabled the button control.
  • form- refers to the id of the form.
  • formaction- refers to the value of the action attribute of the form,
  • formenctype- specifies the value that is used to encode the content while submitting the form to the server.
  • formmethod- specifies the methods of the HTTP at the time of submitting the button control. possible values are get, post, put and delete.
  • formnovalidate- specifies that the form is not to validate at the time of submitting of button control.
  • formtarget- specifies the destination,such as new tab or a new window, to load the browsing  context.
  • name- provides the name to the button control
  • type- specifies the type of button control. values are submit, reset, button.
  • value- provides a value to the button control. you can use this attribute is the form attribute is present.
example 1

<!Doctype Html>
<html>
<body>
<h1>Button element</h1>
<form>
Username : <input type="text" name="username" ><br />
Password : <input type="password" name="password"><br />
<button type="submit" style="color:blue; font-size:20px;">Submit </button>
<button type="reser" style="color:green; font-size:20px;">Reset </button>
<button type="button" style="color:yellow; font-size:20px;">Normal </button>
</form>
</body>
</html>
example 2
<!Doctype Html>
<html>
<body>
<h1>Button element</h1>
<form>
Username : <input type="text" name="username" ><br />
Password : <input type="password" name="password"><br />
<button type="submit"><img src="submit.jpg" width="70" height="50" /> </button>
<button type="reset"><img src="reset.jpg" width="70" height="50" /> </button>
</form>
</body>
</html>



HTML Form Element,Form Submission, Input Type Element

Form Element
form is an area on a webpage that consist of plain text, html elements, and controls. Plain text and html are used to structure the form, while controls which are also known as the form fields, are used to make the form interactive by allowing user to enter information.
Attributes of form element

  • action- refers to the uniform resource locator of the program in the server that processes the form.
  • autocomplete- enables the autocomplete feature in the form.
  • accept-character- refers to the character set in the form that can be accepted by the server.
  • enctype- specifies how the information in the form should be encoded before sending it to the server.
  • method- specifies how the information is sent from browser to server.
  • name- refers to the name of the form.
  • novalidate- specifies that the form should not validate while submitting.
  • target- opens the action url in the specified target, such as in the same window, new window or new tab.
Submitting a form
After the information has been filled by the user, the user submits the form by clicking the submit button and sends the information to the server for processing. The process of transfer of the information from browser to server is performed by the enctype, action and method attributes of the form element.
The enctype attribute encodes the information from the form before transmitting it from the browser to server.
The action attribute specifies the url of the program that handles the information contained in the form.
The method attribute specifies how the information is transferred from the browser to server.

The enctype Attribute
The enctype attribute encodes the information from the form before transmitting it from the browser to server so that the information is not corrupted during the transmission. The encoding is performed by the browser. Three types of encoding process are application/x-www-form-urlencoding,
multipart/formdata and text/plain.
The application/x-www-form-urlencoding is the default encoding if no value is set for the enctype encoding.
The multipart/formdata encoding is used for those forms that contains file selection field.
The text/plain  can be used along with mailto url to send information to an email address rather than a server.

The action Attribute
The action attribute specifies the url of the program that handles the information contained in the form.
<form action="http://www.webtechomaster/home/update">
the name of the program that handles the form is update and it is placed in home directory.

The method Attribute
The method attribute specifies how the information is transferred from the browser to server.
There are two methods get and post. The get method sends the information by adding it to url of the web page. This method is used when data small and there is no issue of securing it.
The post method is used when large amount of data is send to the server. It is more secure way of sending data. The data is send in two steps. In the first step, browser contacts the form processing program and in second step it sends the information to the server.
<form method="get" action="http://www.webtechomaster/home/update">
<form method="post" action="http://www.webtechomaster/home/update">

Types of Input Element
  • text 
  • tel
  • url
  • email
  • password
  • datetime-local
  • datetime
  • date
  • month
  • week
  • time
  • number
  • range
  • file
  • hidden
  • checkbox
  • radio 
  • submit
  • reset

HTML Audio, Video, Embed, Object Element

HTML Audio Element
This element is used to insert audio on a web page. You can play the audio on your web page using this element.The text between the starting and ending tags is the alternate text for the browser that does not support  this element.
Attributes of Audio Element
  • autoplay- plays the audio as soon as the Web page loads.
  • controls- displays the controls on the web page such as play button.
  • loop- replays the audio file
  • preload- specifies whether the audio file is preloaded on the web page or not.
  • src- specifies the location of the audio file.
ex: 
<!Doctype Html>
<html>
<body>
<h1>Audio</1>
<audio src="hamariadhurikahani.mp3" controls autoplay="true">
Your Browser does not support audio element
</audio>
</body>
</html>


HTML Video Element
This element is used to insert video file on a web page.The text between the starting and ending tags is the alternate text for the browser that does not support  this element.
Attributes of Video element
  • autoplay- plays the audio as soon as the Web page loads.
  • controls- displays the controls on the web page such as play button.
  • loop- replays the audio file
  • preload- specifies whether the audio file is preloaded on the web page or not.
  • src- specifies the location of the video file.
  • height- specifies the height of the video file.
  • poster- provides an image to be displayed when the video file is not available.
  • width- specifies the width of the video file.
Example:
 <!Doctype Html>
<html>
<body>
<h1>Video</1>
<video src="jeena.mkv" controls >
Your Browser does not support video element
</audio>
</body>
</html>


HTML Embed Element
Allows you to embed multimedia and plug-ins on a webpage.
src, height and width are the mandatory attributes of the embed element.
Attributes of Embed Element
  • height- specifies the height of the embedded object.
  • src- specifies the location of the file.
  • width- specifies the width of the embedded object.
  • type- specifies the multipurpose internet mail extension type for the component.
  • hspace- sets the horizontal padding around the object.
example: 
<!Doctype Html>
<html>
<body>
<h1>Video</1>
<embed src="jeena.mkv" width="200" height="200" >
</embed>
</body>
</html>

HTML Object Element
This element is used to include object such as Images, Videos, Audios, Java applets, Active X Controls, PDF, flash objects in a web page.
The text between the starting and ending tags is the alternate text for the browser that does not support  this element.
Attributes of Object element
  • height- specifies the height of the object.
  • width- specifies the width of the object.
  • type- specifies the multipurpose internet mail extension type for the component.
  • data- specifies the url of the object data.
  • form- specifies the one or more form to which this object belongs.
  • name- specifies the object name,
  • usemap- specifies the url.
example:
<!Doctype Html>
<html>
<body>
<h1>Video</1>
<object data="jeena.mkv" type="video/mkv" width="200" height="200" >
Your Browser does not support Object element />
</object>
</body>
</html>

HTML Physical and Logical Style Elements

Formatting HTML Text

HTML Physical style elements
how the text will appear on the screen can be controlled by physical style element.
you can make your text appear bold, italic or some other according to your need using physical style elements.

Physical style elements in HTML

  • B Element- display text in bold.
  • I Element- display text in italics.
  • SMALL Element- display text in small font size.
  • SUB Element- display text as subscript.
  • SUP Element- display text as superscript.
Attributes of physical style elements

  • class- indicates a class name for an element
  • dir- indicates direction of text, like left-to-right or right-to-left
  • id- indicates unique id for an element
  • lang- indicates language code for the content in an element
  • style- indicates an inline style for an element
  • title- title for an element
HTML Logical styles element
this elements specify that the enclosed elements has a specific meaning, context or usage.

The different types of logical style elements are:
  • ABBR-  represents an abbreviation.
  • CODE: represents code text.
  • SAMP: represents sample computer code.
  • KBD: represents keyboard text.
  • EM: represents an emphasized text.
  • STRONG: Represents a strong text.
  • DFN: represents the additional definition term.
  • Q: represents short Quotation.
  • BLOCKQUOTE: represents long quotation.
  • INS: represents inserted text.
  • DEL: represent deleted text.
  • VAR: represents a variable part of the text.
  • BDO: represents the text direction.
Attributes of Logical style elements
  • class- indicates a class name for an element
  • dir- indicates direction of text, like left-to-right or right-to-left
  • id- indicates unique id for an element
  • lang- indicates language code for the content in an element
  • style- indicates an inline style for an element
  • title- title for an element
Mark Element
It is used to highlight the text in an html document.

Attributes of Mark element
  • class- indicates a class name for an element
  • id- indicates unique id for an element
  • style- indicates an inline style for an element
  • title- title for an element

Strong Element
Used to emphasized important text. text appears bold.

Attributes of Strong element
  • class- indicates a class name for an element
  • id- indicates unique id for an element
  • style- indicates an inline style for an element
  • title- title for an element

Code Element
Used to represent computer code in html.

Attributes of code element
  • class- indicates a class name for an element
  • id- indicates unique id for an element
  • style- indicates an inline style for an element
  • title- title for an element

Small Element
Makes the text appear small.

Attributes of small element
  • class- indicates a class name for an element
  • id- indicates unique id for an element
  • style- indicates an inline style for an element
  • title- title for an element
ex:
<!Doctype Html>
<html>
<head>htmltitle</head>
<body>
<b> this is bold text</b><br/>
<i> this is italic text</i><br/>
<small> this is small text</small><br/>
this is<sub> subscript</sub><br/>
this is<sup> superscript</sup><br/>
<code>&lt;!doctype html&gt;<br/>
&lt;html&gt;<br/>
&lt;head&gt;<br/>
&lt;/head&gt;<br/>
&lt;body&gt;<br/>
&lt;/body&gt;<br/>
&lt;/html&gt;
<p> the mark element is used to <mark style="background-color:blue;">
mark or hightlight the text </mark> in an html document
</body>
</html>