Showing posts with label HTML. Show all posts
Showing posts with label HTML. Show all posts

Tuesday, August 6, 2013

Form Elements(HTML)

FORM

    • Form on a web page allows user to enter data that is sent to a server for further processing
    • An HTML FORM is a section of document containing normal text, markup and some special elements.
    • That special elements is known as “Controls”.
    • FORM tag tells the browser where the form starts and ends.
    • You can add all kinds of HTML tags between the <FORM> and </FORM>.
    • The purpose of form element is to present a fill out form to be used for an actions such as registration, queries etc.
    • HTML defines the following control types:
    • Buttons
      • Submit
      • Reset
      • Push
    • Checkboxes
    • Radio Button
    • Menus
    • Text
    • Files
    • Hidden Controls
    • Object Controls

Form Attributes 


  • Action
This attribute specifies a form processing agent
  • EncType
This attribute specifies the content type used to submit the form to the server
  • Name
Specifies the FORM name
  • Method
This attribute specifies which HTTP method will be used to submit the form data set.


GET

    • While Using Back button, GET request is re-executed
    • GET method pages can be bookmarked
    • Page can be hacked
    • Page can be cached
    • since form data is in the URL and URL length is restricted
    • GET is less secure compared to POST
    • Values will be displayed in the browser's address bar
    • GET method should not be used for sending sensitive information
    • It can't be more than 255 characters long.


POST

    • The browser usually alerts the user that data will need to be re-submitted.
    • POST method pages cannot be bookmarked.
    • Page never hacked
    • Page not cached
    • No restrictions
    • POST is safer than GET
    • POST method variables are not displayed in the URL
    • POST method can be used for sending sensitive information
    • Whereas no such maximum length limitation holds for the POST request.


<INPUT> ELEMENT

    • This tag is used to obtain user input in a variety of ways.
    • It tells the server the type of data to be submitted by the form.
    • Attributes:
      • Type
      • Name
      • Value
      • Size
      • Maxlength
      • Checked
      • Src
      • Align


<TYPE> ATTRIBUTE

    • It determines which control will be created on the form.
    • It can take any of the following values:
      • Text
      • Password
      • Checkbox
      • Radio
      • Image
      • Hidden
      • Submit
      • Reset
      • Button
      • File


<INPUT Type=“TEXT”>
It is used to create a single line text input field.

<INPUT Type=“PASSWORD”>
In this type the input text is rendered in a way to hide the characters.
This control is used for sensitive input such as password.
<INPUT Type=“CHECK BOX”>
Creates an on-screen checkbox for users to make multiple selections.
Checkbox is an on or off switch.
When the switch is checked the value is “yes” else “no”.
This allows user to select more than one value for a given property.
<INPUT type=“CHECKBOX” NAME=“CH1” VALUE=“A” Checked>

<INPUT Type=“RADIO”>
Creates an on-screen radio button for user to make a single selection.
It is also an on or off switch.
The radio button value is only submitted with the form when the switch is on.
<INPUT type=“RADIO” NAME=“RD1” VALUE=“Yes” Checked”>

<INPUT Type=“IMAGE”>
Creates a graphical submit button.
The image value of the type attribute has only one difference from the submit attribute.
<INPUT TYPE=“IMAGE” SRC=“submit_image.gif”>
<INPUT Type=“HIDDEN”>
Creates an element that is not visible by the user.
<INPUT TYPE=“HIDDEN” value=“lotus”>

<INPUT Type=“SUBMIT”>
Creates a submit button.
When this button is activated by the user, the form is submitted to the location specified by the action attribute of the form element.
<INPUT TYPE=“SUBMIT” value=“Submit the Form”>
<INPUT Type=“RESET”>
Creates a reset button.
When this button is activated by the user, all of the form’s controls have their values reset to the initial values specified in the controls on the form.
<INPUT TYPE=“RESET” VALUE=“Reset the Form”>

<INPUT Type=“BUTTON”>
Creates a generalized button.
Unlike the submit or reset buttons, it has no predetermined action.
<INPUT TYPE=“BUTTON” Value=“Click me”>

<INPUT Type=“FILE”>
Creates a control which is used for file uploading.
The field consists of a text entry box for a filename as well as a button immediately to the right of the field, which is usually labeled BROWSE.
Pressing the Browse….. Button allows the user to browse the local system to find a file to specify for upload.
<INPUT TYPE=“FILE”>


<SELECT>
  • The SELECT element is used to create a list of choices either as a dropdown menu or a list box.
  • Each of the choices in the list is an OPTION element.
  • There are two tags involved in creating select lists, the <SELECT> tag and the <OPTION> tag.
  • The <SELECT> tag offsets the lists .
Attributes:

  • Name
Assigns a name to the element.
  • Size
Numbers of rows in the list that should be visible on the form.
  • Multiple
This boolean attributes allow multiple selections.
  • Disabled
Locks the field where user can’t change the value. Even user cant select option, cant copy text and the field is not even sent if the form is submitted.


<OPTION>
    • Used along with <SELECT> to create select lists.
    • The <OPTION> is used to list the possible values. It has only two attributes.
    • Selected
      • When set this boolean attribute specifies that this option is pre-selected.
    • Value
      • This attribute specifies the value to be submitted for this choice, if the choice is selected,when the form is submitted.

  >Eg:
<SELECT NAME=“listname”>
<OPTION value=“LIST1”>ITEM1
<OPTION value=“LIST2”>ITEM2
<OPTION value=“LIST3”>ITEM3
<OPTION value=“LIST4”>ITEM4
</SELECT>

<TEXTAREA>
The TEXTAREA element is similar to the INPUT element’s text type.
Instead of single line text box, a multi-line text input control is created.
Because there are many lines of text within the <TEXTAREA> element, it is not possible to set the default text for the textarea using the VALUE attribute.
The default text is placed between the <TEXTAREA> …………</TEXTAREA> tags.

>ATTRIBUTES

  • NAME:
Assigns a name to the element.
  • ROWS:
Specifies the number of visible text lines.
  • COLS:
Specifies the visible width in a average character widths.

  >Eg:
<TEXTAREA NAME=“ADDRESS”ROWS=“2” COLS=“20”>……….
</TEXTAREA>

<FIELDSET> ELEMENT

  • It defines a group of form elements as being logically related.
  • The browser draws a box around the set of fields to indicate that they are related.
  • <FIELDSET> is a block level element, so there is no need to use <P> tag between fieldsets


  >Example:
<FIELDSET>
<INPUT TYPE=“Checkbox” name=“sports”>Sports
<INPUT TYPE=“Checkbox” name=“Shopping”>Shopping
<INPUT TYPE=“Checkbox” name=“Music”>Music
<INPUT TYPE=“Checkbox” name=“Dancing”>Dancing
</FIELDSET>

<LEGEND> ELEMENT

  • It is used with <FIELDSET>to give a title to each set of fields.

<FIELDSET>
<LEGEND>Hobbies</LEGEND>
<INPUT TYPE=“Checkbox” name=“sports”>Sports
<INPUT TYPE=“Checkbox” name=“Shopping”>Shopping
<INPUT TYPE=“Checkbox” name=“Music”>Music
<INPUT TYPE=“Checkbox” name=“Dancing”>Dancing
</FIELDSET>

Frame Element(HTML)

FRAME


    • Frame allows you to divide the page into several rectangular areas and to display a separate document in each rectangle.
    • Each of those rectangle is known as “Frame”.
    • Using frames, you can display multiple HTML document in the same browser window.
    • Each HTML document is called a frame, and each frame is independent of the others.


FRAMESET

    • The frameset element holds one or more <FRAMESET> or <FRAME> elements. Each frame element can hold a separate document.

Example:
<frameset cols="25%,50%,25%">
<frame src="frame_a.htm" />
<frame src="frame_b.htm" />
<frame src="frame_c.htm" />
</frameset>
NOFRAME

    • The <noframes> tag is used for browsers that do not handle frames.
    • The noframes element can contain all the elements that you can find inside the body element of a normal HTML page.
    • The noframes element is most used to link to a non-frameset version of the web site or to display a message to users that frames are required.
    • The noframes element goes inside the frameset element.


ROWS
“pixels|percents” defines the row height of each row(vertical) within the frameset. The value of each row height is a comma separated list of sizes
COLS
“pixels|percents” defines the column width of each column(horizontal) within the frameset.The value of each column width is a comma separated list of sizes
ONLOAD
“script” to specify client-side scripting actions to perform when the frame is loaded.
ONUNLOAD
“script” to specify client-side scripting actions to perform when the frame is removed
FRAMEBORDER
To give border around all frames
BORDER
Controls width of all borders
BORDERCOLOR
To change the color of the frame borders
<FRAME> ELEMENT
Defines a frame.
Each frame must contained within a Frameset document that defines the dimension of the frame.
ATTRIBUTE

    • SRC
    • Name
    • NoResize
    • Scrolling-value(Yes,no or auto)
    • Marginheight
    • MarginWidth
    • FrameBorder-Value(0 or 1),Specifies whether or not to display a border around a frame


Monday, August 5, 2013

Introduction to HTML

HTML

    • HTML stands for Hyper Text Markup Language.(The markup is the instructions for displaying or printing the text.)
    • HTML is not a programming languages but it is a markup language.
    • A markup language is a set of markup tags.
    • HTML uses markup tags to describe web pages.
    • It is a descriptive markup language that describes the structure and behavior of a web documents.
    • HTML was created by Tim Berners-Lee
    • HTML is a set of code that can be embedded in text to add formatting and linking information.
    • It allows these different kinds of data to be displayed together.    
    • HTML is nothing more than a plain text file that allows for the inclusion of two kinds of text:
      • The Content
        • Text or information to be displayed or played back on the client’s screen.
      • The Markup
        • Text or information to control the display or to point to other information items in need of display .

HTML TAGS

    • Tags are the instructions that are embedded directly into the text of the document.
    • An HTML tag is a signal to the browser that it should do something other than just throw text up on the screen.
    • By conventional all HTML tags begin with an open an angle bracket(<) and end with close angle bracket(>).
    • HTML is specified as TAGs in an HTML document(i.e. Web Page)
    • There are two types of HTML tags:
      • Paired Tags
      • Singular Tags( stand-alone tags/ unpaired tags)

Paired Tags


    • A tag is said to be a paired tag if the text is placed between a tag and its companion tag.
    • In paired tags, the first tag is referred to as opening tag and the second tag is referred to as closing tag.
      • Example:
        • <i>Welcome</i>
        • Here, <i> is called opening tag and </i> is called a closing tag
      • Here are some more examples
        • <html>
        • <head>
        • <title>
        • <body>
        • <p>
        • <h#>
        • <address>
        • <nobr>
        • <center>
        • <block quote>
        • <pre>
        • <font>
        • <strike>
        • <b>
        • <i>
        • <big>
        • <small>
        • <sub>
        • <sup>
        • <u>
        • <lists>
        • <div>
        • <strong>

 Singular tag
    • A Singular tag does not have a companion tag.
    • Singular tags are also known as unpaired tags or Stand-Alone tags.
      • Example:
        • <br>
        •  <hr>
      • This tags does not require any companion tag.
        • <doctype>
        • <br>
        • <hr>
        • <basefont>
        • <meta>
HTML Tag


    • Some HTML tags require additional information to be supplied to them.
      • For example:-
        • When a picture is placed on the screen, information like the height and the width of the picture can be specified.
    • Additional information supplied to an HTML tag is known as Attributes of a Tag.
    • Attributes are written immediately following the tag, separated by a space.
      • <table border="1">
    • Multiple attributes can be associated with a tag, also separated by space.

HTML document 

    • An HTML document contains two distinct parts:
    • The head
    • The body.
    • The head contains information about the document that is not displayed on the screen.
    • The body contains everything else that is displayed as part of the web of page

<HTML>
<HEAD>
…………..
<!-- header information & it is not displayed on the page
</HEAD>
<BODY>
…………..
<!-- all the HTML for display>
</BODY>
</HTML>
Head Eement

    • <HEAD> contains general information, or meta-information, about the document.
    • The head of the HTML document is an unordered collection of information about the document.
    • The main head element is a <TITLE> tag.
    • The contents of the <HEAD> are not displayed as part of the document text
    • It is just written after the <HTML> tag.
      • <TITLE>
      • <BASE>
      • <ISINDEX>
      • <NEXTID>
      • <LINK>
      • <META>
      • <STYLE>
      • <SCRIPT>

Title Element

    • The title of a document is specified by the TITLE element.
    • The TITLE element should occur in the HEAD of the document.
    • There may be only one title in any document.
    • It should identify the content of the document.
    • The <TITLE> element is not part of the body text, it is displayed in the window title.
    • It may not contain anchors, paragraph or any highlighting or other HTML Tag.
    • The title may be used to identify the node in a history list.
    • Your title should be descriptive but short, less than 64 characters.

Body Element 

    • It specifies the main content of the document.
    • Body tag is placed immediately after the closing head tag(</Head>) and before any image or text included in the document.
    • The body of the HTML document contains all the text and images that make up the page together with all the HTML elements that provide the control or formatting of the page.
    • It is possible to control the document color scheme and background by specifying certain attributes in the <BODY ….> declaration.
      • Attributes are
        • used to point to an image file
        • BgColor: allow settings of background color
        • Text: used to change the text color

For Additional Quarries Please put Your Valuable Comment (!)