Web 4 Utpal
Web 4 Utpal
SUBMITTED BY:
LECT.ANUPAMA SINGH
UTPAL PRATAP SINGH
Student’s Signature :
Q1. What is the significance of a form & the attributes used in form
tag? Design a feedback form for Mc Donald customers.
ANS:- Forms
A form is an area that can contain form elements.
Form elements are elements that allow the user to enter information (like text
fields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form.
<form>
input elements
</form>
Input
The most used form tag is the <input> tag. The type of input is specified with the type
attribute. The most commonly used input types are explained below.
Text Fields
Text fields are used when you want the user to type letters, numbers, etc. in a form.
<form>
First name:
<br />
Last name:
</form>
Radio Buttons
Radio Buttons are used when you want the user to select one of a limited number of
choices.
<form>
<br />
</form>
Checkboxes
Checkboxes are used when you want the user to select one or more options of a limited
number of choices.
<form>
I have a bike:
<br />
I have a car:
<br />
I have an airplane:
</form>
When the user clicks on the "Submit" button, the content of the form is sent to the
server. The form's action attribute defines the name of the file to send the content to.
The file defined in the action attribute usually does something with the received input.
Username:
</form>
<html>
<body>
<form>
Customers</center></font><br><br>
Name Of Customer: <input type="Text"
name="Customer"></input><br>
Mobile Number: <input
type="Text" name="Contact"></input><br><br>
Select a Country:
<option>America</option>
<option>Australia</option>
<option>Canada</option>
<option>England</option>
<option>India</option>
<option>Russia</option>
</select><br><br>
</form>
</table>
</html>
Q2. What are various controls used in forms, enumerate with the help
of example.
ANS:- There are actually three types of text input used on forms:
Single-line text input controls: Used for items that require only one line of user input,
such as search boxes or names. They are created using the <input> element.
Password input controls: Single-line text input that mask the characters a user enters.
Multi-line text input controls: Used when the user is required to give details that may
be longer than a single sentence. Multi-line input controls are created with the
<textarea> element.
Here is a basic example of a single-line text input used to take first name and last name:
First name:
<br>
Last name:
</form>
First name
Last name
submit
Following is the list of attributes for <input> tag.
type: Indicates the type of input control you want to create. This element is also used to
create other form controls such as radio buttons and checkboxes.
name: Used to give the name part of the name/value pair that is sent to the server,
representing each form control and the value the user entered.
value: Provides an initial value for the text input control that the user will see when the
form loads.
size: Allows you to specify the width of the text-input control in terms of characters.
maxlength: Allows you to specify the maximum number of characters a user can enter
into the text box.
This is also a form of single-line text input controls are created using an <input>
element whose type attribute has a value of password.
Here is a basic example of a single-line password input used to take user password:
Login :
<br>
Password:
</form>
Login
Password
submi
Here is a basic example of a multi-line text input used to take item description:
<form action="/cgi-bin/hello_get.cgi" method="get">
Description : <br />
<textarea rows="5" cols="50" name="description">
Enter description here...
</textarea>
<input type="submit" value="submit" />
</form>
Description :
Enter description here…….
subm
it
name: The name of the control. This is used in the name/value pair that is sent to the
server.
a) Submit button
b) Radio button
c) Button
e) Pop ups
ANS:-
<form action="http://www.example.com/test.asp"
method="get">
</form>
b) Radio button:-
Here is example HTML code for a form with two radio button:
<form action="/cgi-bin/radiobutton.cgi"
method="post">
<input type="radio" name="subject" value="maths" />
Maths
</form>
Here is example HTML code for a form with two radio button
Maths Select
physics
subject
value: Used to indicate the value that will be sent to the server if this option is
selected.
checked: Indicates that this option should be selected by default when the page
loads
c) button: This creates a button that is used to trigger a client-side script when
the user clicks that button.
<form action="http://www.example.com/test.asp"
method="get">
</form>
f) Pull down menus:
Pull down menu is used when we have many options available to be selected
but only one or two will be selected..
Here is example HTML code for a form with one Pull down menu
Submit
multiple: If set to "multiple" then allows a user to select multiple items from the
menu.
value: The value that is sent to the server if this option is selected.
selected: Specifies that this option should be the initially selected value when the
page loads.
c) Pop ups:
The technique described here addresses all the major issues
in popups. The popup always comes to the front. Different links can target the
same popup.
Creating a popup
<!--
function popitup(url) {
newwindow=window.open(url,'name','height=200,width=150');
if (window.focus) {newwindow.focus()}
return false;
// -->
</script>
Part-B
The <iframe> tag is not used within a <frameset> tag. Instead, it appears anywhere in
your document. The <iframe> tag defines a rectangular region within the document in
which the browser displays a separate document, including scrollbars and borders.
Use the src attribute with <iframe> to specify the URL of the document that occupies
the inline frame.
All of the other, optional attributes for the <iframe> tag, including name, class,
frameborder, id, longdesc, marginheight, marginwidth, name, scrolling, style, and title
behave exactly like the corresponding attributes for the <frame> tag.
Following is the example to show how to use the <iframe>. This tag is used along with
<body> tag:
<body>
...other document content...
<iframe src="/html/menu.htm" width="75" height="200" align="right">
Your browser does not support inline frames. To view this
<a href="/html/menu.htm">document</a> correctly, you'll need
a copy of Internet Explorer or the latest Netscape Navigator.
</iframe>
...subsequent document content...
</body>
Q5. Using suitable example, enumerate the purpose of Global and ass
files in ASP.
ANS:- Ans: The Global.asa file is an optional file that can contain declarations of
objects, variables, and methods that can be accessed by every page in an ASP
application.
All valid browser scripts (JavaScript, VBScript, JScript, PerlScript, etc.) can be used
within Global.asa.
• Application events
• Session events
• <object> declarations
• TypeLibrary declarations
For example we will create a Global.asa file that counts the number of current visitors.
• The Application_OnStart sets the Application variable "visitors" to 0 when the server
starts
• The Session_OnStart subroutine adds one to the variable "visitors" every time a new
visitor arrives
• The Session_OnEnd subroutine subtracts one from "visitors" each time this
subroutine is triggered
Once you have the correct JDBC driver installed, establishing a JDBC connection from
your Java programs to your SQL database is pretty easy.
import java.sql.*;
class JdbcTest1 {
Class.forName("com.imaginary.sql.msql.MsqlDriver");
catch (Exception e)
System.err.println(e.getMessage());
import java.sql.*;
class JdbcTest1
{
public static void main (String[] args)
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
catch (Exception e)
System.err.println(e.getMessage());