{"id":34,"date":"2018-07-26T05:00:48","date_gmt":"2018-07-26T05:00:48","guid":{"rendered":"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=34"},"modified":"2018-08-02T04:31:42","modified_gmt":"2018-08-02T04:31:42","slug":"html","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/chapter\/html\/","title":{"rendered":"HTML"},"content":{"raw":"<div>\r\n\r\n<strong>\u00a0 \u00a0 \u00a0Introduction<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Tables provide a means of organizing the layout of data. A table is divided into rows and columns and these specify the cells of the table. Cells can contain text, images, links, other tables etc. The HTML tables allow web developers to arrange data like text, images, links, other tables, etc. into rows and columns of cells. Tables can also be used for organizing the layout of the web page itself. These HTML tables can be created using the <strong>&lt;table&gt;<\/strong> tag in which the <strong>&lt;tr&gt;<\/strong> tag is used to create table rows and <strong>&lt;td&gt;<\/strong> tag is used to create data cells. In simple, we can understand that the HTML Table Element &lt;table&gt; represents data in two dimensions or more.<\/p>\r\n&nbsp;\r\n\r\n<strong>HTML Tables<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe &lt;TABLE&gt;&lt;\/TABLE&gt; element has four sub-elements:\r\n\r\n&nbsp;\r\n\r\n1. Table Row&lt;TR&gt;&lt;\/TR&gt;.\r\n\r\n2. Table Header &lt;THEAD&gt;&lt;\/THEAD&gt; and Table Footer &lt;TFOOT&gt;&lt;\/TFOOT&gt;.\r\n\r\n3. Table Data &lt;TD&gt;&lt;\/TD&gt;.\r\n\r\n4. Caption &lt;CAPTION&gt;&lt;\/CAPTION&gt;.\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The Table rows can be grouped into a head, foot, and body sections using the <a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/tables.html#edef-THEAD\">THEAD, <\/a><a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/tables.html#edef-TFOOT\">TFOOT <\/a>and <a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/tables.html#edef-TBODY\">TBODY <\/a>elements, respectively. Head section also called the header cell is defined with a &lt;thead&gt; element that contains the header information such as column names.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The &lt;thead&gt; tag must be used as a child of a &lt;table&gt; element, after any &lt;caption&gt;, and &lt;colgroup&gt; elements, and before any &lt;tbody&gt;, &lt;tfoot&gt;, and &lt;tr&gt; elements.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The Foot section is defined with a &lt;tfoot&gt; element are the footer rows that appears at the bottom of the table. The purpose of this &lt;thead&gt; and &lt;tfoot&gt; elements are that when long tables are printed, the head and foot information may be repeated on each page that contains table data.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The Table body is defined with a &lt;tbody&gt; element. Otherwise they are called as data cells defined with &lt;td&gt; element.We can use at most one &lt;thead&gt; or &lt;tfoot&gt; but we can use multiple &lt;tbody&gt; elements in a table.The caption tag is the descriptive title and used to provide a short description about the table's purpose or it can be used to name the table.<\/p>\r\n&nbsp;\r\n\r\n<strong>Example:<\/strong>\r\n\r\n&nbsp;\r\n\r\nThe anatomy of how a table can be created in HTML is shown in the below code.\r\n\r\n&nbsp;\r\n\r\n<strong>&lt;table border=\u201c1\u201d&gt;<\/strong>\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;th&gt; Column 1 header &lt;\/th&gt;\r\n\r\n&lt;th&gt; Column 2 header &lt;\/th&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;td&gt; Row1, Col1 &lt;\/td&gt;\r\n\r\n&lt;td&gt; Row1, Col2 &lt;\/td&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;td&gt; Row2, Col1 &lt;\/td&gt;\r\n\r\n&lt;td&gt; Row2, Col2 &lt;\/td&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;\/table&gt;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In the above example the table is defined with the <strong>&lt;table&gt;<\/strong> tag. Tables are divided into <strong>table rows<\/strong> with the <strong>&lt;tr&gt;<\/strong> tag. Table rows are divided into <strong>table data<\/strong> with the <strong>&lt;td&gt;<\/strong> tag. A table row can also be divided\u00a0<span style=\"text-align: initial;font-size: 1em\">into <\/span><strong style=\"text-align: initial;font-size: 1em\">table headings<\/strong><span style=\"text-align: initial;font-size: 1em\"> with the <\/span><strong style=\"text-align: initial;font-size: 1em\">&lt;th&gt;<\/strong><span style=\"text-align: initial;font-size: 1em\"> tag. By default, all major browsers display table headings as bold and centered:<\/span><span style=\"text-align: initial;font-size: 1em\">We can also use &lt;th&gt;&lt;\/th&gt; as <\/span><strong style=\"text-align: initial;font-size: 1em\">row headings<\/strong><span style=\"text-align: initial;font-size: 1em\"> as well as <\/span><strong style=\"text-align: initial;font-size: 1em\">column headings<\/strong><span style=\"text-align: initial;font-size: 1em\">. One of the basic differences between &lt;thead&gt; and &lt;th&gt; is that &lt;thead&gt; is a block level element, whereas &lt;th&gt; is an inline-block. &lt;th&gt; also has a special attribute, scope so we can designate what it is a heading of, the column or the row.<\/span><\/p>\r\n&nbsp;\r\n\r\n<\/div>\r\n<div>\r\n\r\n<strong>\u00a0 \u00a0 Tables Attributes<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Some of the table attributes that can be used with the &lt;table&gt; element is given below:<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>BGColor: <\/strong>Some browsers support background colors in a table.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Width: <\/strong>We can specify the table width as an absolute number of pixels or a percentage of the document width. We can set the width for the table cells as well.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Border: <\/strong>We can choose a numerical value for the border width, which specifies the border in pixels.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>CellSpacing: <\/strong>Cell Spacing represents the space between cells and is specified in pixels.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>CellPadding: <\/strong>Cell Padding is the space between the cell border and the cell contents and is specified in pixels.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Align: <\/strong>Tables can have left, right, or center alignment.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>Background: <\/strong>Background Image, will be titled in IE3.0 and above. BorderColor, BorderColorDark.<\/p>\r\n&nbsp;\r\n\r\n<strong>Example1: HTML Table: table1.html<\/strong>\r\n\r\n&nbsp;\r\n\r\n&lt;table border = \"1\" width = \"40%\"\r\n\r\nsummary = \"This table provides information about the price of fruit\"&gt; &lt;caption&gt;&lt;strong&gt;Price of Fruit&lt;\/strong&gt;&lt;\/caption&gt;\r\n\r\n&lt;thead&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;th&gt;Fruit&lt;\/th&gt;\r\n\r\n&lt;th&gt;Price&lt;\/th&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;\/thead&gt;\r\n\r\n&lt;tfoot&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;th&gt;Total&lt;\/th&gt;\r\n\r\n&lt;th&gt;$3.75&lt;\/th&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;\/tfoot&gt;\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">&lt;tbody&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Apple&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;$0.25&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Orange&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;$0.50&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Banana&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;$1.00&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Pineapple&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;$2.00&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/tbody&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/table&gt;<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The above code displays the table with a caption as \"Price of Fruit\". The table has a &lt;thead&gt; element and a &lt;tfoot&gt; element. The table body starts with a &lt;tbody&gt; element which holds the content or data of the table. The table body has four rows. Table attributes such as &lt;border&gt;, &lt;width&gt; and &lt;summary&gt; has been used in the example. The attribute &lt;summary&gt; is new in HTML5. The output of the above code is shown in the below Figure 5.1.<\/p>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-35 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-4.png\" alt=\"\" width=\"282\" height=\"248\" \/><\/p>\r\n<p style=\"text-align: center\"><strong>Figure 5.1<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Example 2: HTML Table: table2.html<\/strong>\r\n\r\n&nbsp;\r\n\r\n&lt;html&gt;\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">&lt;head&gt;&lt;title&gt;Table Cells&lt;\/title&gt;&lt;\/head&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;body&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;table cellspacing=\"15\" cellpadding=\"0\"&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;&lt;td&gt;First&lt;\/td&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Second&lt;\/td&gt;&lt;\/tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/table&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;br\/&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;table cellspacing=\"0\" cellpadding=\"10\"&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;&lt;td&gt;First&lt;\/td&gt;&lt;td&gt;Second&lt;\/td&gt;&lt;\/tr&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/table&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/body&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/html&gt;<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Example 2 explains about the table attributes cellspacing and cellpadding. The example specifies that there are two tables to differentiate and understand about cell spacing and cell padding. The first table has a cell spacing of 15 pixels that represents the space between cells. The second table has a cellpadding of 10 pixels which is the space between the cell border and the cell contents. The output of this HTML table is shown in the below Figure 5.2.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-36 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-5.png\" alt=\"\" width=\"356\" height=\"277\" \/><\/p>\r\n<p style=\"text-align: center\"><strong>Figure 5.2<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Rows and Columns<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Cells can span multiple columns and multiple rows with the <strong>colspan<\/strong> and <strong>rowspan<\/strong> attributes. In order to make a cell span more than one column we can use the <strong>colspan<\/strong> attribute and to make a cell span more than one row we can use the <strong>rowspan<\/strong> attribute.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">An example to show that how we use the colspan and rowspan attributes. The table is defined with three rows. The first row specifies the heading where the heading cell 'name' spans over two columns. In the second row, the data cell 'Fishing' spans over two rows. The output of the below code is shown in FIgure 5.3.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n<strong>\u00a0 <\/strong>\r\n\r\n<strong>Example 3:<\/strong>\r\n\r\n&nbsp;\r\n\r\n&lt;table border=\"1\"&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n<strong>&lt;th colspan=\"2\"&gt;Name&lt;\/th&gt;<\/strong>\r\n\r\n&lt;th&gt;Course&lt;\/th&gt;\r\n\r\n&lt;th&gt;Year&lt;\/th&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;td&gt;A B&lt;\/td&gt;\r\n\r\n&lt;td&gt;Morgan&lt;\/td&gt;\r\n\r\n<strong>&lt;td rowspan=\"2\"&gt;Fishing&lt;\/td&gt;<\/strong>\r\n\r\n&lt;td&gt;5&lt;\/td&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;td&gt;D J&lt;\/td&gt;\r\n\r\n&lt;td&gt;Jones&lt;\/td&gt;\r\n\r\n&lt;td&gt;Sailing&lt;\/td&gt;\r\n\r\n&lt;td&gt;8&lt;\/td&gt; &lt;\/tr&gt; &lt;tr&gt; &lt;\/table&gt;\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-37 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-6.png\" alt=\"\" width=\"373\" height=\"172\" \/><\/p>\r\n<p style=\"text-align: center\"><strong>Figure 5.3<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Example 4:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The table is defined with four rows. In the first row, the heading cell 'name' spans over two columns and the heading cell 'course' and 'year' spans over two rows. The second row has the data cell 'last' and 'init'.<span style=\"text-align: initial;font-size: 1em\">The next two rows doesn't span over columns or rows. The output of the below code is shown in FIgure 5.4.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n&lt;table border=\"1\" align=\"center\"&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;th colspan=\"2\" width=\"60%\"&gt;Name&lt;\/th&gt;\r\n\r\n&lt;th rowspan=\"2\"&gt;Course&lt;\/th&gt;\r\n\r\n&lt;th rowspan=\"2\"&gt;Year&lt;\/th&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;th&gt;Last&lt;\/th&gt;\r\n\r\n&lt;th&gt;Init.&lt;\/th&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;tr&gt;\r\n\r\n&lt;td&gt;Morgan&lt;\/td&gt;\r\n\r\n&lt;td&gt;AB&lt;\/td&gt;\r\n\r\n&lt;td&gt;Fishing&lt;\/td&gt;\r\n\r\n&lt;td align=\"center\"&gt;5&lt;\/td&gt;\r\n\r\n&lt;\/tr&gt;\r\n\r\n&lt;!\u2013 etc --&gt;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-38 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-7.png\" alt=\"\" width=\"323\" height=\"191\" \/><\/p>\r\n<p style=\"text-align: center\"><strong>Figure 5.4<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Introduction to Forms<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">An HTML form is an area of a document that contains normal content, markup, special elements called form elements or controls such as checkboxes, radio buttons, menus, text fields etc., and labels on those controls. Forms are used to create (rather primitive) GUIs on Web pages. Users generally use a form in a web page to send information to a web server or a mail server by entering text, selecting menu items, etc., for processing.<\/p>\r\n&nbsp;\r\n\r\n&lt;form&gt; is just another kind of HTML tag.The syntax to create a form is &lt;form <strong><em>parameters<\/em><\/strong>&gt; <strong><em>...form elements...<\/em><\/strong> &lt;\/form&gt;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">Form elements include: buttons, checkboxes, text fields, radio buttons, drop-down menus, etc. Other kinds of tags can be mixed in with the form elements.<\/span><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">A form usually contains a <\/span><strong style=\"text-align: initial;font-size: 1em\">Submit button<\/strong><span style=\"text-align: initial;font-size: 1em\"> to send the information in the form elements to the server.<\/span><span style=\"text-align: initial;font-size: 1em\">The form\u2019s parameters tell JavaScript how to send the information to the server. There are two different ways it could be sent to the server.<\/span><\/p>\r\n\r\n<\/div>\r\n<div>\r\n\r\n\u00a0 \u00a0Forms can also be used for other things, such as a GUI for simple programs\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\"><strong>The &lt;form&gt; tag<\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">The &lt;form <strong><em>arguments<\/em><\/strong>&gt; ... &lt;\/form&gt; tag encloses form elements and probably other elements as well.<\/p>\r\n<p style=\"text-align: justify\">The arguments to form tell what to do with the user input. Below is the list of arguments that can be used with the &lt;form&gt; tag.<\/p>\r\n&nbsp;\r\n<p style=\"text-align: justify\">\u2013 action=\"<strong><em>url<\/em><\/strong>\"(required)<\/p>\r\n<p style=\"text-align: justify\">\u2022 Specifies where to send the data when the Submit button is clicked<\/p>\r\n<p style=\"text-align: justify\">\u2013\u00a0 method=\"get\"\u00a0 (default)<\/p>\r\n<p style=\"text-align: justify\">\u2022\u00a0 Form data is sent as a URL with ?form_data information appended to the end of the URL. This method can be used only if data is all ASCII and not more than 100 characters<\/p>\r\n<p style=\"text-align: justify\">\u2013 method=\"post\"<\/p>\r\n<p style=\"text-align: justify\">\u2022\u00a0 Form data is sent in the body of the URL request and cannot be bookmarked by most browsers<\/p>\r\n<p style=\"text-align: justify\">\u2013\u00a0 target=\"<strong><em>target<\/em><\/strong>\"<\/p>\r\n<p style=\"text-align: justify\">\u2022\u00a0 Specifies where to open the page sent as a result of the request. If<\/p>\r\n<p style=\"text-align: justify\">'<strong><em>target<\/em>=<\/strong>_blank' means the page has to be opened in a new window. If '<strong><em>target<\/em>=<\/strong> _top' means use the same window when the page is opened.<\/p>\r\n&nbsp;\r\n\r\n<strong>The &lt;input&gt; tag<\/strong>\r\n\r\n&nbsp;\r\n\r\nMost, but not all, form elements use the input tag, with a type=\"...\" argument to tell which kind of element it is. The type can be text, checkbox, radio, password, hidden, submit, reset, button, file, or image.\r\n\r\n&nbsp;\r\n\r\nOther common input tag arguments include:\r\n<ul>\r\n \t<li>name: the name of the element.<\/li>\r\n \t<li><span style=\"text-align: initial;font-size: 1em\">id: a unique identifier for the element.<\/span><\/li>\r\n \t<li><span style=\"text-align: initial;font-size: 1em\">value: the \u201cvalue\u201d of the element; used in different ways for different values of type.<\/span><\/li>\r\n \t<li><span style=\"text-align: initial;font-size: 1em\">readonly: the value cannot be changed.<\/span><\/li>\r\n \t<li><span style=\"text-align: initial;font-size: 1em\">disabled: the user can\u2019t do anything with this element.<\/span><\/li>\r\n \t<li style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">O<\/span><span style=\"text-align: initial;font-size: 1em\">ther arguments are defined for the input tag but have meaning only for certain values of type<\/span><\/li>\r\n<\/ul>\r\n<\/div>\r\n<div>\r\n\r\n<strong>\u00a0 \u00a0 \u00a0 Text input<\/strong>\r\n\r\n&nbsp;\r\n\r\nA text field can be created in a form using the following syntax.\r\n\r\n&lt;input type=\"text\" name=\"textfield\" value=\"with an initial value\" \/&gt;\r\n\r\nThe output of the above code is displayed in Figure 5.5.\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-39 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-8.png\" alt=\"\" width=\"405\" height=\"49\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 5.5<\/strong><\/p>\r\n&nbsp;\r\n\r\nA multi-line text field can be created in a form using the below syntax.\r\n\r\n&lt;textarea name=\"textarea\" cols=\"24\" rows=\"2\"&gt;Hello&lt;\/textarea&gt;\r\n\r\nThe output of the above code is displayed in Figure 5.6.\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-40 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-9.png\" alt=\"\" width=\"440\" height=\"54\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 5.6<\/strong><\/p>\r\n&nbsp;\r\n\r\n<em>Note that two of these use the input tag, but one uses textarea.<\/em>\r\n\r\n&nbsp;\r\n\r\n<strong>Password field<\/strong>\r\n\r\n&nbsp;\r\n\r\n&lt;input type=\"password\" name=\"textfield3\" value=\"secret\" \/&gt;\r\n\r\nThe output of the above code is displayed in Figure 5.7.\r\n\r\n<\/div>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-41 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-10.png\" alt=\"\" width=\"385\" height=\"27\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong><span style=\"text-align: initial;font-size: 1em\">Figure 5.7<\/span><\/strong><\/p>\r\n\r\n<div>\r\n\r\n<strong>\u00a0 \u00a0 Buttons<\/strong>\r\n\r\n&nbsp;\r\n\r\nA submit button can be created using the below syntax\r\n\r\n&lt;input type=\"submit\" name=\"Submit\" value=\"Submit\" \/&gt;\r\n\r\nA reset button can be created using the below syntax\r\n\r\n&lt;input type=\"reset\" name=\"Submit2\" value=\"Reset\" \/&gt;\r\n\r\nA plain button can be created using the below syntax\r\n\r\n&lt;input type=\"button\" name=\"Submit3\" value=\"Push Me\" \/&gt;\r\n\r\nThe output of the above code is displayed in Figure 5.8.\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-42 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-11.png\" alt=\"\" width=\"249\" height=\"109\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 5.8<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Radio buttons<\/strong>\r\n\r\n&nbsp;\r\n\r\nRadio buttons are used when it is required to select one option from a set of alternatives. Radio buttons can be created using the below syntax,Radio buttons can be created using the below syntax,\r\n\r\n&nbsp;\r\n\r\nRadio buttons:&lt;br&gt;\r\n\r\n&lt;input type=\"radio\" name=\"radiobutton\" value=\"myValue1\" \/&gt;male&lt;br&gt;\r\n\r\n&lt;input type=\"radio\" name=\"radiobutton\" value=\"myValue2\u201d checked=\"checked\" \/&gt;female\r\n\r\nThe output of the above code is displayed in Figure 5.9.\r\n\r\n&nbsp;\r\n\r\n<\/div>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-43 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-12.png\" alt=\"\" width=\"172\" height=\"60\" \/><\/p>\r\n<p style=\"text-align: center\"><strong><span style=\"text-align: initial;font-size: 1em\">Figure 5.9<\/span><\/strong><\/p>\r\n\r\n<div>\r\n<p style=\"text-align: justify\">When a user clicks on a radio-button, it becomes checked, and all other radio-buttons with equal name become unchecked.<\/p>\r\n&nbsp;\r\n\r\n<strong>Labels<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In many cases, the labels for controls are not part of the control. For example, &lt;input type=\"radio\" name=\"gender\" value=\"m\" \/&gt;male<\/p>\r\n<p style=\"text-align: justify\">In this case, clicking on the word \u201cmale\u201d has no effect.<\/p>\r\n<p style=\"text-align: justify\">A label tag will bind the text to the control<\/p>\r\n<p style=\"text-align: justify\">&lt;label&gt;&lt;input type=\"radio\" name=\"gender\" value=\"m\" \/&gt;male&lt;\/label&gt;<\/p>\r\n<p style=\"text-align: justify\">With the above syntax, clicking on the word \u201cmale\u201d now clicks the radio button.<\/p>\r\n&nbsp;\r\n\r\n<strong>Checkboxes<\/strong>\r\n\r\n&nbsp;\r\n\r\nCheckboxes are used when more options are to be allowed at the same time. A checkbox can be created using the below syntax,\r\n\r\n&nbsp;\r\n\r\n&lt;input type=\"checkbox\" name=\"checkbox\" value=\"checkbox\" checked=\"checked\"&gt;\r\n\r\n&nbsp;\r\n\r\nThe output of the above code is displayed in Figure 5.10.\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"alignnone size-full wp-image-44\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-13.png\" alt=\"\" width=\"204\" height=\"31\" \/><\/p>\r\n<p style=\"text-align: center\"><strong>Figure 5.10<\/strong><\/p>\r\n&nbsp;\r\n\r\nThe attributes of this control are,\r\n<ul>\r\n \t<li>\u00a0type: \"checkbox\"<\/li>\r\n \t<li>\u00a0name: used to reference this form element from JavaScript<\/li>\r\n \t<li>\u00a0value: value to be returned when element is checked<\/li>\r\n<\/ul>\r\n<p style=\"text-align: justify\"><em>Note that there is no text associated with the checkbox Unless we use a label tag, only clicking on the box itself has any effect.<\/em><\/p>\r\n&nbsp;\r\n\r\n<strong>Drop-down menu or list<\/strong>\r\n\r\n&nbsp;\r\n\r\nA menu or list can be created using the following syntax,\r\n\r\n&lt;select name=\"select\"&gt;\r\n\r\n<span style=\"font-size: 1em;text-align: initial\">&lt;option value=\"red\"&gt;red&lt;\/option&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;option value=\"green\"&gt;green&lt;\/option&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;option value=\"BLUE\"&gt;blue&lt;\/option&gt;<\/span>\r\n\r\n<span style=\"text-align: initial;font-size: 1em\">&lt;\/select&gt;<\/span>\r\n\r\n<\/div>\r\n<div>\r\n\r\n&nbsp;\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">The &lt;select&gt; element is used to create a drop-down list and the &lt;option&gt; tags inside the &lt;select&gt; element define the available options in the list.<\/p>\r\nThe output of the above code is displayed in Figure 5.11.\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-45 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-14.png\" alt=\"\" width=\"318\" height=\"43\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 5.11<\/strong><\/p>\r\n&nbsp;\r\n\r\nThe additional attributes of this control are,\r\n<ul>\r\n \t<li><em>size<\/em>: the number of items visible in the list (default is \"1\")<\/li>\r\n \t<li><em>multiple<\/em><\/li>\r\n \t<li>If set to \"true\" (or just about anything else), any number of items may be selected.<\/li>\r\n \t<li>If omitted, only one item may be selected.<\/li>\r\n \t<li>If set to \"false\", behavior depends on the particular browser.<\/li>\r\n<\/ul>\r\n<strong>\u00a0 \u00a0 \u00a0Hidden fields<\/strong>\r\n\r\n&nbsp;\r\n\r\nHidden fields are similar to text fields that does not show on the page.\r\n\r\nA hidden field:\r\n\r\n&lt;input type=\"hidden\" name=\"hiddenField\" value=\"nyah\"&gt; &amp;lt;-- right there, don't you see it?\r\n\r\nThe output of the above code is displayed in Figure 5.12.\r\n<p style=\"text-align: center\"><strong><img class=\"size-full wp-image-46 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-15.png\" alt=\"\" width=\"346\" height=\"37\" \/><\/strong><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 5.12<\/strong><\/p>\r\n\r\n<\/div>\r\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">The purpose of this hidden field is that all input fields are sent back to the server, including hidden fields. This is a way to include information that the user doens\u2019t need to see or that we don\u2019t want others to see.The value of a hidden field can be set programmatically (by JavaScript) before the form is submitted.<\/span><span style=\"text-align: initial;font-size: 1em\">Now let us look at an example that includes the controls what we have seen earlier.<\/span><\/p>\r\n\r\n<div>\r\n\r\n<strong><em>\u00a0 \u00a0 <\/em><\/strong>\r\n\r\n<strong><em>Example<\/em><\/strong>\r\n\r\n&nbsp;\r\n\r\nIn this example, a form is created with a text field and radio buttons.\r\n\r\n&nbsp;\r\n\r\n&lt;html&gt;\r\n\r\n&lt;head&gt;\r\n\r\n&lt;title&gt;Get Identity&lt;\/title&gt;\r\n\r\n&lt;\/head&gt;\r\n\r\n&lt;body&gt;\r\n\r\n&lt;p&gt;&lt;b&gt;Who are you?&lt;\/b&gt;&lt;\/p&gt;\r\n\r\n&lt;form method=\"post\" action=\"\"&gt;\r\n\r\n&lt;p&gt;Name:\r\n\r\n&lt;input type=\"text\" name=\"textfield\"&gt;\r\n\r\n&lt;\/p&gt;\r\n\r\n&lt;p&gt;Gender:\r\n\r\n&lt;label&gt;&lt;input type=\"radio\" name=\"gender\" value=\"m\u201c \/&gt;Male&lt;label&gt; &lt;label&gt;&lt;input type=\"radio\" name=\"gender\" value=\"f\" \/&gt;Female&lt;\/label&gt;\r\n\r\n&lt;\/p&gt;\r\n\r\n&lt;\/form&gt;\r\n\r\n&lt;\/body&gt;\r\n\r\n&lt;\/html&gt;\r\n\r\n&nbsp;\r\n\r\nThe output of the above code is displayed in Figure 5.13.\r\n\r\n&nbsp;\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-47 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-16.png\" alt=\"\" width=\"286\" height=\"85\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 5.13<\/strong><\/p>\r\n&nbsp;\r\n\r\nLet us now look at a complete example that includes all the controls. The form that is displayed in the web page is shown in Figure 5.14.\r\n\r\nThe list of all controls has been summarized as below,\r\n<ul>\r\n \t<li>text<\/li>\r\n \t<li>checkbox<\/li>\r\n \t<li>radio (buttons)<\/li>\r\n \t<li><span style=\"font-size: 1em\">select (options)<\/span><\/li>\r\n \t<li><span style=\"font-size: 1em\">textarea<\/span><\/li>\r\n \t<li><span style=\"font-size: 1em\">password<\/span><\/li>\r\n \t<li><span style=\"font-size: 1em\">b<\/span><span style=\"font-size: 1em\">utton<\/span><\/li>\r\n \t<li><span style=\"font-size: 1em\">submit<\/span><\/li>\r\n \t<li><span style=\"font-size: 1em\">reset<\/span><\/li>\r\n \t<li><span style=\"font-size: 1em\">hidden<\/span><\/li>\r\n \t<li><span style=\"font-size: 1em\">file<\/span><\/li>\r\n \t<li><span style=\"font-size: 1em\">image<\/span><\/li>\r\n<\/ul>\r\n<\/div>\r\n<p style=\"text-align: center\"><img class=\"size-full wp-image-48 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-17.png\" alt=\"\" width=\"437\" height=\"396\" \/><\/p>\r\n&nbsp;\r\n<p style=\"text-align: center\"><strong>Figure 5.14<\/strong><\/p>\r\n&nbsp;\r\n\r\n<strong>Summary<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">In this module we looked at HTML in detail and explored about the Tables in HTML. This module also explains about the HTML Forms with syntax and examples in detail.<\/p>\r\n&nbsp;\r\n\r\n<strong>Web Links<\/strong>\r\n<ul>\r\n \t<li><em>Internet and World Wide Web How to Program \u2013 Deitel, Deitel and Nieto<\/em><\/li>\r\n \t<li><em>www.cs.cf.ac.uk\/Dave\/Internet\/Lectures\/<strong>Frames<\/strong>_Tables_Forms.<strong>ppt<\/strong><\/em><\/li>\r\n \t<li><em>http:\/\/w3schools.com\/HTML<\/em><\/li>\r\n \t<li><em>http:\/\/www.tutorialspoint.com\/html\/<\/em><\/li>\r\n<\/ul>","rendered":"<div>\n<p><strong>\u00a0 \u00a0 \u00a0Introduction<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Tables provide a means of organizing the layout of data. A table is divided into rows and columns and these specify the cells of the table. Cells can contain text, images, links, other tables etc. The HTML tables allow web developers to arrange data like text, images, links, other tables, etc. into rows and columns of cells. Tables can also be used for organizing the layout of the web page itself. These HTML tables can be created using the <strong>&lt;table&gt;<\/strong> tag in which the <strong>&lt;tr&gt;<\/strong> tag is used to create table rows and <strong>&lt;td&gt;<\/strong> tag is used to create data cells. In simple, we can understand that the HTML Table Element &lt;table&gt; represents data in two dimensions or more.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>HTML Tables<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The &lt;TABLE&gt;&lt;\/TABLE&gt; element has four sub-elements:<\/p>\n<p>&nbsp;<\/p>\n<p>1. Table Row&lt;TR&gt;&lt;\/TR&gt;.<\/p>\n<p>2. Table Header &lt;THEAD&gt;&lt;\/THEAD&gt; and Table Footer &lt;TFOOT&gt;&lt;\/TFOOT&gt;.<\/p>\n<p>3. Table Data &lt;TD&gt;&lt;\/TD&gt;.<\/p>\n<p>4. Caption &lt;CAPTION&gt;&lt;\/CAPTION&gt;.<\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The Table rows can be grouped into a head, foot, and body sections using the <a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/tables.html#edef-THEAD\">THEAD, <\/a><a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/tables.html#edef-TFOOT\">TFOOT <\/a>and <a href=\"http:\/\/www.w3.org\/TR\/html401\/struct\/tables.html#edef-TBODY\">TBODY <\/a>elements, respectively. Head section also called the header cell is defined with a &lt;thead&gt; element that contains the header information such as column names.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The &lt;thead&gt; tag must be used as a child of a &lt;table&gt; element, after any &lt;caption&gt;, and &lt;colgroup&gt; elements, and before any &lt;tbody&gt;, &lt;tfoot&gt;, and &lt;tr&gt; elements.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The Foot section is defined with a &lt;tfoot&gt; element are the footer rows that appears at the bottom of the table. The purpose of this &lt;thead&gt; and &lt;tfoot&gt; elements are that when long tables are printed, the head and foot information may be repeated on each page that contains table data.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The Table body is defined with a &lt;tbody&gt; element. Otherwise they are called as data cells defined with &lt;td&gt; element.We can use at most one &lt;thead&gt; or &lt;tfoot&gt; but we can use multiple &lt;tbody&gt; elements in a table.The caption tag is the descriptive title and used to provide a short description about the table&#8217;s purpose or it can be used to name the table.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The anatomy of how a table can be created in HTML is shown in the below code.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>&lt;table border=\u201c1\u201d&gt;<\/strong><\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;th&gt; Column 1 header &lt;\/th&gt;<\/p>\n<p>&lt;th&gt; Column 2 header &lt;\/th&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;td&gt; Row1, Col1 &lt;\/td&gt;<\/p>\n<p>&lt;td&gt; Row1, Col2 &lt;\/td&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;td&gt; Row2, Col1 &lt;\/td&gt;<\/p>\n<p>&lt;td&gt; Row2, Col2 &lt;\/td&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;\/table&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In the above example the table is defined with the <strong>&lt;table&gt;<\/strong> tag. Tables are divided into <strong>table rows<\/strong> with the <strong>&lt;tr&gt;<\/strong> tag. Table rows are divided into <strong>table data<\/strong> with the <strong>&lt;td&gt;<\/strong> tag. A table row can also be divided\u00a0<span style=\"text-align: initial;font-size: 1em\">into <\/span><strong style=\"text-align: initial;font-size: 1em\">table headings<\/strong><span style=\"text-align: initial;font-size: 1em\"> with the <\/span><strong style=\"text-align: initial;font-size: 1em\">&lt;th&gt;<\/strong><span style=\"text-align: initial;font-size: 1em\"> tag. By default, all major browsers display table headings as bold and centered:<\/span><span style=\"text-align: initial;font-size: 1em\">We can also use &lt;th&gt;&lt;\/th&gt; as <\/span><strong style=\"text-align: initial;font-size: 1em\">row headings<\/strong><span style=\"text-align: initial;font-size: 1em\"> as well as <\/span><strong style=\"text-align: initial;font-size: 1em\">column headings<\/strong><span style=\"text-align: initial;font-size: 1em\">. One of the basic differences between &lt;thead&gt; and &lt;th&gt; is that &lt;thead&gt; is a block level element, whereas &lt;th&gt; is an inline-block. &lt;th&gt; also has a special attribute, scope so we can designate what it is a heading of, the column or the row.<\/span><\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<div>\n<p><strong>\u00a0 \u00a0 Tables Attributes<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Some of the table attributes that can be used with the &lt;table&gt; element is given below:<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>BGColor: <\/strong>Some browsers support background colors in a table.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Width: <\/strong>We can specify the table width as an absolute number of pixels or a percentage of the document width. We can set the width for the table cells as well.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Border: <\/strong>We can choose a numerical value for the border width, which specifies the border in pixels.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>CellSpacing: <\/strong>Cell Spacing represents the space between cells and is specified in pixels.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>CellPadding: <\/strong>Cell Padding is the space between the cell border and the cell contents and is specified in pixels.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Align: <\/strong>Tables can have left, right, or center alignment.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>Background: <\/strong>Background Image, will be titled in IE3.0 and above. BorderColor, BorderColorDark.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example1: HTML Table: table1.html<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;table border = &#8220;1&#8221; width = &#8220;40%&#8221;<\/p>\n<p>summary = &#8220;This table provides information about the price of fruit&#8221;&gt; &lt;caption&gt;&lt;strong&gt;Price of Fruit&lt;\/strong&gt;&lt;\/caption&gt;<\/p>\n<p>&lt;thead&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;th&gt;Fruit&lt;\/th&gt;<\/p>\n<p>&lt;th&gt;Price&lt;\/th&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;\/thead&gt;<\/p>\n<p>&lt;tfoot&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;th&gt;Total&lt;\/th&gt;<\/p>\n<p>&lt;th&gt;$3.75&lt;\/th&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;\/tfoot&gt;<\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">&lt;tbody&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Apple&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;$0.25&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Orange&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;$0.50&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Banana&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;$1.00&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Pineapple&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;$2.00&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/tbody&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/table&gt;<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The above code displays the table with a caption as &#8220;Price of Fruit&#8221;. The table has a &lt;thead&gt; element and a &lt;tfoot&gt; element. The table body starts with a &lt;tbody&gt; element which holds the content or data of the table. The table body has four rows. Table attributes such as &lt;border&gt;, &lt;width&gt; and &lt;summary&gt; has been used in the example. The attribute &lt;summary&gt; is new in HTML5. The output of the above code is shown in the below Figure 5.1.<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-35 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-4.png\" alt=\"\" width=\"282\" height=\"248\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-4.png 282w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-4-65x57.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-4-225x198.png 225w\" sizes=\"auto, (max-width: 282px) 100vw, 282px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 5.1<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example 2: HTML Table: table2.html<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;html&gt;<\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">&lt;head&gt;&lt;title&gt;Table Cells&lt;\/title&gt;&lt;\/head&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;body&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;table cellspacing=&#8221;15&#8243; cellpadding=&#8221;0&#8243;&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;&lt;td&gt;First&lt;\/td&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;td&gt;Second&lt;\/td&gt;&lt;\/tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/table&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;br\/&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;table cellspacing=&#8221;0&#8243; cellpadding=&#8221;10&#8243;&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;tr&gt;&lt;td&gt;First&lt;\/td&gt;&lt;td&gt;Second&lt;\/td&gt;&lt;\/tr&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/table&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/body&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/html&gt;<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Example 2 explains about the table attributes cellspacing and cellpadding. The example specifies that there are two tables to differentiate and understand about cell spacing and cell padding. The first table has a cell spacing of 15 pixels that represents the space between cells. The second table has a cellpadding of 10 pixels which is the space between the cell border and the cell contents. The output of this HTML table is shown in the below Figure 5.2.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-36 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-5.png\" alt=\"\" width=\"356\" height=\"277\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-5.png 356w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-5-300x233.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-5-65x51.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-5-225x175.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-5-350x272.png 350w\" sizes=\"auto, (max-width: 356px) 100vw, 356px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 5.2<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Rows and Columns<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Cells can span multiple columns and multiple rows with the <strong>colspan<\/strong> and <strong>rowspan<\/strong> attributes. In order to make a cell span more than one column we can use the <strong>colspan<\/strong> attribute and to make a cell span more than one row we can use the <strong>rowspan<\/strong> attribute.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">An example to show that how we use the colspan and rowspan attributes. The table is defined with three rows. The first row specifies the heading where the heading cell &#8216;name&#8217; spans over two columns. In the second row, the data cell &#8216;Fishing&#8217; spans over two rows. The output of the below code is shown in FIgure 5.3.<\/span><\/p>\n<\/div>\n<div>\n<p><strong>\u00a0 <\/strong><\/p>\n<p><strong>Example 3:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;table border=&#8221;1&#8243;&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p><strong>&lt;th colspan=&#8221;2&#8243;&gt;Name&lt;\/th&gt;<\/strong><\/p>\n<p>&lt;th&gt;Course&lt;\/th&gt;<\/p>\n<p>&lt;th&gt;Year&lt;\/th&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;td&gt;A B&lt;\/td&gt;<\/p>\n<p>&lt;td&gt;Morgan&lt;\/td&gt;<\/p>\n<p><strong>&lt;td rowspan=&#8221;2&#8243;&gt;Fishing&lt;\/td&gt;<\/strong><\/p>\n<p>&lt;td&gt;5&lt;\/td&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;td&gt;D J&lt;\/td&gt;<\/p>\n<p>&lt;td&gt;Jones&lt;\/td&gt;<\/p>\n<p>&lt;td&gt;Sailing&lt;\/td&gt;<\/p>\n<p>&lt;td&gt;8&lt;\/td&gt; &lt;\/tr&gt; &lt;tr&gt; &lt;\/table&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-37 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-6.png\" alt=\"\" width=\"373\" height=\"172\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-6.png 373w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-6-300x138.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-6-65x30.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-6-225x104.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-6-350x161.png 350w\" sizes=\"auto, (max-width: 373px) 100vw, 373px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 5.3<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Example 4:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The table is defined with four rows. In the first row, the heading cell &#8216;name&#8217; spans over two columns and the heading cell &#8216;course&#8217; and &#8216;year&#8217; spans over two rows. The second row has the data cell &#8216;last&#8217; and &#8216;init&#8217;.<span style=\"text-align: initial;font-size: 1em\">The next two rows doesn&#8217;t span over columns or rows. The output of the below code is shown in FIgure 5.4.<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>&lt;table border=&#8221;1&#8243; align=&#8221;center&#8221;&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;th colspan=&#8221;2&#8243; width=&#8221;60%&#8221;&gt;Name&lt;\/th&gt;<\/p>\n<p>&lt;th rowspan=&#8221;2&#8243;&gt;Course&lt;\/th&gt;<\/p>\n<p>&lt;th rowspan=&#8221;2&#8243;&gt;Year&lt;\/th&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;th&gt;Last&lt;\/th&gt;<\/p>\n<p>&lt;th&gt;Init.&lt;\/th&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;tr&gt;<\/p>\n<p>&lt;td&gt;Morgan&lt;\/td&gt;<\/p>\n<p>&lt;td&gt;AB&lt;\/td&gt;<\/p>\n<p>&lt;td&gt;Fishing&lt;\/td&gt;<\/p>\n<p>&lt;td align=&#8221;center&#8221;&gt;5&lt;\/td&gt;<\/p>\n<p>&lt;\/tr&gt;<\/p>\n<p>&lt;!\u2013 etc &#8211;&gt;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-38 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-7.png\" alt=\"\" width=\"323\" height=\"191\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-7.png 323w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-7-300x177.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-7-65x38.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-7-225x133.png 225w\" sizes=\"auto, (max-width: 323px) 100vw, 323px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 5.4<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Introduction to Forms<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">An HTML form is an area of a document that contains normal content, markup, special elements called form elements or controls such as checkboxes, radio buttons, menus, text fields etc., and labels on those controls. Forms are used to create (rather primitive) GUIs on Web pages. Users generally use a form in a web page to send information to a web server or a mail server by entering text, selecting menu items, etc., for processing.<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;form&gt; is just another kind of HTML tag.The syntax to create a form is &lt;form <strong><em>parameters<\/em><\/strong>&gt; <strong><em>&#8230;form elements&#8230;<\/em><\/strong> &lt;\/form&gt;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">Form elements include: buttons, checkboxes, text fields, radio buttons, drop-down menus, etc. Other kinds of tags can be mixed in with the form elements.<\/span><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">A form usually contains a <\/span><strong style=\"text-align: initial;font-size: 1em\">Submit button<\/strong><span style=\"text-align: initial;font-size: 1em\"> to send the information in the form elements to the server.<\/span><span style=\"text-align: initial;font-size: 1em\">The form\u2019s parameters tell JavaScript how to send the information to the server. There are two different ways it could be sent to the server.<\/span><\/p>\n<\/div>\n<div>\n<p>\u00a0 \u00a0Forms can also be used for other things, such as a GUI for simple programs<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\"><strong>The &lt;form&gt; tag<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The &lt;form <strong><em>arguments<\/em><\/strong>&gt; &#8230; &lt;\/form&gt; tag encloses form elements and probably other elements as well.<\/p>\n<p style=\"text-align: justify\">The arguments to form tell what to do with the user input. Below is the list of arguments that can be used with the &lt;form&gt; tag.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">\u2013 action=&#8221;<strong><em>url<\/em><\/strong>&#8220;(required)<\/p>\n<p style=\"text-align: justify\">\u2022 Specifies where to send the data when the Submit button is clicked<\/p>\n<p style=\"text-align: justify\">\u2013\u00a0 method=&#8221;get&#8221;\u00a0 (default)<\/p>\n<p style=\"text-align: justify\">\u2022\u00a0 Form data is sent as a URL with ?form_data information appended to the end of the URL. This method can be used only if data is all ASCII and not more than 100 characters<\/p>\n<p style=\"text-align: justify\">\u2013 method=&#8221;post&#8221;<\/p>\n<p style=\"text-align: justify\">\u2022\u00a0 Form data is sent in the body of the URL request and cannot be bookmarked by most browsers<\/p>\n<p style=\"text-align: justify\">\u2013\u00a0 target=&#8221;<strong><em>target<\/em><\/strong>&#8220;<\/p>\n<p style=\"text-align: justify\">\u2022\u00a0 Specifies where to open the page sent as a result of the request. If<\/p>\n<p style=\"text-align: justify\">&#8216;<strong><em>target<\/em>=<\/strong>_blank&#8217; means the page has to be opened in a new window. If &#8216;<strong><em>target<\/em>=<\/strong> _top&#8217; means use the same window when the page is opened.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>The &lt;input&gt; tag<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Most, but not all, form elements use the input tag, with a type=&#8221;&#8230;&#8221; argument to tell which kind of element it is. The type can be text, checkbox, radio, password, hidden, submit, reset, button, file, or image.<\/p>\n<p>&nbsp;<\/p>\n<p>Other common input tag arguments include:<\/p>\n<ul>\n<li>name: the name of the element.<\/li>\n<li><span style=\"text-align: initial;font-size: 1em\">id: a unique identifier for the element.<\/span><\/li>\n<li><span style=\"text-align: initial;font-size: 1em\">value: the \u201cvalue\u201d of the element; used in different ways for different values of type.<\/span><\/li>\n<li><span style=\"text-align: initial;font-size: 1em\">readonly: the value cannot be changed.<\/span><\/li>\n<li><span style=\"text-align: initial;font-size: 1em\">disabled: the user can\u2019t do anything with this element.<\/span><\/li>\n<li style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">O<\/span><span style=\"text-align: initial;font-size: 1em\">ther arguments are defined for the input tag but have meaning only for certain values of type<\/span><\/li>\n<\/ul>\n<\/div>\n<div>\n<p><strong>\u00a0 \u00a0 \u00a0 Text input<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>A text field can be created in a form using the following syntax.<\/p>\n<p>&lt;input type=&#8221;text&#8221; name=&#8221;textfield&#8221; value=&#8221;with an initial value&#8221; \/&gt;<\/p>\n<p>The output of the above code is displayed in Figure 5.5.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-39 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-8.png\" alt=\"\" width=\"405\" height=\"49\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-8.png 405w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-8-300x36.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-8-65x8.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-8-225x27.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-8-350x42.png 350w\" sizes=\"auto, (max-width: 405px) 100vw, 405px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 5.5<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>A multi-line text field can be created in a form using the below syntax.<\/p>\n<p>&lt;textarea name=&#8221;textarea&#8221; cols=&#8221;24&#8243; rows=&#8221;2&#8243;&gt;Hello&lt;\/textarea&gt;<\/p>\n<p>The output of the above code is displayed in Figure 5.6.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-40 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-9.png\" alt=\"\" width=\"440\" height=\"54\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-9.png 440w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-9-300x37.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-9-65x8.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-9-225x28.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-9-350x43.png 350w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 5.6<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><em>Note that two of these use the input tag, but one uses textarea.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Password field<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&lt;input type=&#8221;password&#8221; name=&#8221;textfield3&#8243; value=&#8221;secret&#8221; \/&gt;<\/p>\n<p>The output of the above code is displayed in Figure 5.7.<\/p>\n<\/div>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-41 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-10.png\" alt=\"\" width=\"385\" height=\"27\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-10.png 385w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-10-300x21.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-10-65x5.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-10-225x16.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-10-350x25.png 350w\" sizes=\"auto, (max-width: 385px) 100vw, 385px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong><span style=\"text-align: initial;font-size: 1em\">Figure 5.7<\/span><\/strong><\/p>\n<div>\n<p><strong>\u00a0 \u00a0 Buttons<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>A submit button can be created using the below syntax<\/p>\n<p>&lt;input type=&#8221;submit&#8221; name=&#8221;Submit&#8221; value=&#8221;Submit&#8221; \/&gt;<\/p>\n<p>A reset button can be created using the below syntax<\/p>\n<p>&lt;input type=&#8221;reset&#8221; name=&#8221;Submit2&#8243; value=&#8221;Reset&#8221; \/&gt;<\/p>\n<p>A plain button can be created using the below syntax<\/p>\n<p>&lt;input type=&#8221;button&#8221; name=&#8221;Submit3&#8243; value=&#8221;Push Me&#8221; \/&gt;<\/p>\n<p>The output of the above code is displayed in Figure 5.8.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-42 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-11.png\" alt=\"\" width=\"249\" height=\"109\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-11.png 249w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-11-65x28.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-11-225x98.png 225w\" sizes=\"auto, (max-width: 249px) 100vw, 249px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 5.8<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Radio buttons<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Radio buttons are used when it is required to select one option from a set of alternatives. Radio buttons can be created using the below syntax,Radio buttons can be created using the below syntax,<\/p>\n<p>&nbsp;<\/p>\n<p>Radio buttons:&lt;br&gt;<\/p>\n<p>&lt;input type=&#8221;radio&#8221; name=&#8221;radiobutton&#8221; value=&#8221;myValue1&#8243; \/&gt;male&lt;br&gt;<\/p>\n<p>&lt;input type=&#8221;radio&#8221; name=&#8221;radiobutton&#8221; value=&#8221;myValue2\u201d checked=&#8221;checked&#8221; \/&gt;female<\/p>\n<p>The output of the above code is displayed in Figure 5.9.<\/p>\n<p>&nbsp;<\/p>\n<\/div>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-43 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-12.png\" alt=\"\" width=\"172\" height=\"60\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-12.png 172w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-12-65x23.png 65w\" sizes=\"auto, (max-width: 172px) 100vw, 172px\" \/><\/p>\n<p style=\"text-align: center\"><strong><span style=\"text-align: initial;font-size: 1em\">Figure 5.9<\/span><\/strong><\/p>\n<div>\n<p style=\"text-align: justify\">When a user clicks on a radio-button, it becomes checked, and all other radio-buttons with equal name become unchecked.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Labels<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In many cases, the labels for controls are not part of the control. For example, &lt;input type=&#8221;radio&#8221; name=&#8221;gender&#8221; value=&#8221;m&#8221; \/&gt;male<\/p>\n<p style=\"text-align: justify\">In this case, clicking on the word \u201cmale\u201d has no effect.<\/p>\n<p style=\"text-align: justify\">A label tag will bind the text to the control<\/p>\n<p style=\"text-align: justify\">&lt;label&gt;&lt;input type=&#8221;radio&#8221; name=&#8221;gender&#8221; value=&#8221;m&#8221; \/&gt;male&lt;\/label&gt;<\/p>\n<p style=\"text-align: justify\">With the above syntax, clicking on the word \u201cmale\u201d now clicks the radio button.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Checkboxes<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Checkboxes are used when more options are to be allowed at the same time. A checkbox can be created using the below syntax,<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;input type=&#8221;checkbox&#8221; name=&#8221;checkbox&#8221; value=&#8221;checkbox&#8221; checked=&#8221;checked&#8221;&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>The output of the above code is displayed in Figure 5.10.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-44\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-13.png\" alt=\"\" width=\"204\" height=\"31\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-13.png 204w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-13-65x10.png 65w\" sizes=\"auto, (max-width: 204px) 100vw, 204px\" \/><\/p>\n<p style=\"text-align: center\"><strong>Figure 5.10<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The attributes of this control are,<\/p>\n<ul>\n<li>\u00a0type: &#8220;checkbox&#8221;<\/li>\n<li>\u00a0name: used to reference this form element from JavaScript<\/li>\n<li>\u00a0value: value to be returned when element is checked<\/li>\n<\/ul>\n<p style=\"text-align: justify\"><em>Note that there is no text associated with the checkbox Unless we use a label tag, only clicking on the box itself has any effect.<\/em><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Drop-down menu or list<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>A menu or list can be created using the following syntax,<\/p>\n<p>&lt;select name=&#8221;select&#8221;&gt;<\/p>\n<p><span style=\"font-size: 1em;text-align: initial\">&lt;option value=&#8221;red&#8221;&gt;red&lt;\/option&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;option value=&#8221;green&#8221;&gt;green&lt;\/option&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;option value=&#8221;BLUE&#8221;&gt;blue&lt;\/option&gt;<\/span><\/p>\n<p><span style=\"text-align: initial;font-size: 1em\">&lt;\/select&gt;<\/span><\/p>\n<\/div>\n<div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">The &lt;select&gt; element is used to create a drop-down list and the &lt;option&gt; tags inside the &lt;select&gt; element define the available options in the list.<\/p>\n<p>The output of the above code is displayed in Figure 5.11.<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-45 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-14.png\" alt=\"\" width=\"318\" height=\"43\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-14.png 318w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-14-300x41.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-14-65x9.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-14-225x30.png 225w\" sizes=\"auto, (max-width: 318px) 100vw, 318px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 5.11<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>The additional attributes of this control are,<\/p>\n<ul>\n<li><em>size<\/em>: the number of items visible in the list (default is &#8220;1&#8221;)<\/li>\n<li><em>multiple<\/em><\/li>\n<li>If set to &#8220;true&#8221; (or just about anything else), any number of items may be selected.<\/li>\n<li>If omitted, only one item may be selected.<\/li>\n<li>If set to &#8220;false&#8221;, behavior depends on the particular browser.<\/li>\n<\/ul>\n<p><strong>\u00a0 \u00a0 \u00a0Hidden fields<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Hidden fields are similar to text fields that does not show on the page.<\/p>\n<p>A hidden field:<\/p>\n<p>&lt;input type=&#8221;hidden&#8221; name=&#8221;hiddenField&#8221; value=&#8221;nyah&#8221;&gt; &amp;lt;&#8211; right there, don&#8217;t you see it?<\/p>\n<p>The output of the above code is displayed in Figure 5.12.<\/p>\n<p style=\"text-align: center\"><strong><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-46 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-15.png\" alt=\"\" width=\"346\" height=\"37\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-15.png 346w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-15-300x32.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-15-65x7.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-15-225x24.png 225w\" sizes=\"auto, (max-width: 346px) 100vw, 346px\" \/><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 5.12<\/strong><\/p>\n<\/div>\n<p style=\"text-align: justify\"><span style=\"text-align: initial;font-size: 1em\">The purpose of this hidden field is that all input fields are sent back to the server, including hidden fields. This is a way to include information that the user doens\u2019t need to see or that we don\u2019t want others to see.The value of a hidden field can be set programmatically (by JavaScript) before the form is submitted.<\/span><span style=\"text-align: initial;font-size: 1em\">Now let us look at an example that includes the controls what we have seen earlier.<\/span><\/p>\n<div>\n<p><strong><em>\u00a0 \u00a0 <\/em><\/strong><\/p>\n<p><strong><em>Example<\/em><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>In this example, a form is created with a text field and radio buttons.<\/p>\n<p>&nbsp;<\/p>\n<p>&lt;html&gt;<\/p>\n<p>&lt;head&gt;<\/p>\n<p>&lt;title&gt;Get Identity&lt;\/title&gt;<\/p>\n<p>&lt;\/head&gt;<\/p>\n<p>&lt;body&gt;<\/p>\n<p>&lt;p&gt;&lt;b&gt;Who are you?&lt;\/b&gt;&lt;\/p&gt;<\/p>\n<p>&lt;form method=&#8221;post&#8221; action=&#8221;&#8221;&gt;<\/p>\n<p>&lt;p&gt;Name:<\/p>\n<p>&lt;input type=&#8221;text&#8221; name=&#8221;textfield&#8221;&gt;<\/p>\n<p>&lt;\/p&gt;<\/p>\n<p>&lt;p&gt;Gender:<\/p>\n<p>&lt;label&gt;&lt;input type=&#8221;radio&#8221; name=&#8221;gender&#8221; value=&#8221;m\u201c \/&gt;Male&lt;label&gt; &lt;label&gt;&lt;input type=&#8221;radio&#8221; name=&#8221;gender&#8221; value=&#8221;f&#8221; \/&gt;Female&lt;\/label&gt;<\/p>\n<p>&lt;\/p&gt;<\/p>\n<p>&lt;\/form&gt;<\/p>\n<p>&lt;\/body&gt;<\/p>\n<p>&lt;\/html&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>The output of the above code is displayed in Figure 5.13.<\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-47 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-16.png\" alt=\"\" width=\"286\" height=\"85\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-16.png 286w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-16-65x19.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-16-225x67.png 225w\" sizes=\"auto, (max-width: 286px) 100vw, 286px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 5.13<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Let us now look at a complete example that includes all the controls. The form that is displayed in the web page is shown in Figure 5.14.<\/p>\n<p>The list of all controls has been summarized as below,<\/p>\n<ul>\n<li>text<\/li>\n<li>checkbox<\/li>\n<li>radio (buttons)<\/li>\n<li><span style=\"font-size: 1em\">select (options)<\/span><\/li>\n<li><span style=\"font-size: 1em\">textarea<\/span><\/li>\n<li><span style=\"font-size: 1em\">password<\/span><\/li>\n<li><span style=\"font-size: 1em\">b<\/span><span style=\"font-size: 1em\">utton<\/span><\/li>\n<li><span style=\"font-size: 1em\">submit<\/span><\/li>\n<li><span style=\"font-size: 1em\">reset<\/span><\/li>\n<li><span style=\"font-size: 1em\">hidden<\/span><\/li>\n<li><span style=\"font-size: 1em\">file<\/span><\/li>\n<li><span style=\"font-size: 1em\">image<\/span><\/li>\n<\/ul>\n<\/div>\n<p style=\"text-align: center\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-48 aligncenter\" src=\"http:\/\/csp12.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-17.png\" alt=\"\" width=\"437\" height=\"396\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-17.png 437w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-17-300x272.png 300w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-17-65x59.png 65w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-17-225x204.png 225w, https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-content\/uploads\/sites\/60\/2018\/07\/Untitled-17-350x317.png 350w\" sizes=\"auto, (max-width: 437px) 100vw, 437px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: center\"><strong>Figure 5.14<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">In this module we looked at HTML in detail and explored about the Tables in HTML. This module also explains about the HTML Forms with syntax and examples in detail.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Web Links<\/strong><\/p>\n<ul>\n<li><em>Internet and World Wide Web How to Program \u2013 Deitel, Deitel and Nieto<\/em><\/li>\n<li><em>www.cs.cf.ac.uk\/Dave\/Internet\/Lectures\/<strong>Frames<\/strong>_Tables_Forms.<strong>ppt<\/strong><\/em><\/li>\n<li><em>http:\/\/w3schools.com\/HTML<\/em><\/li>\n<li><em>http:\/\/www.tutorialspoint.com\/html\/<\/em><\/li>\n<\/ul>\n","protected":false},"author":4,"menu_order":5,"template":"","meta":{"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":["dr-m-vijayalakshmi"],"pb_section_license":""},"chapter-type":[],"contributor":[58],"license":[],"class_list":["post-34","chapter","type-chapter","status-publish","hentry","contributor-dr-m-vijayalakshmi"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/34","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/users\/4"}],"version-history":[{"count":20,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/34\/revisions"}],"predecessor-version":[{"id":436,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/34\/revisions\/436"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapters\/34\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/media?parent=34"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/pressbooks\/v2\/chapter-type?post=34"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/contributor?post=34"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp12\/wp-json\/wp\/v2\/license?post=34"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}