HOMEWORK ON web programming 4

SUBJECT: web programming

SUBJECT CODE: cap 305

SUBMITTEDTO: Miss. Narinder Kaur

SUBMITTED BY: Paramjit kaur

CLASS: MCA

SECTION: D3804

ROLL NO: D3804A03

REGD NO: 10803106

Declaration: I declare that this assignment is my individual work, I have not copied from any other student’s work or from any other source except where due acknowledgement is made explicitly in text, not has any part become written for me by another person. Paramjit Kaur

Part A
Q1. What is the significance of a form & the attributes used in form tag? Design a feedback form for Mc Donald customers.
Answer: SIGNIFICANCE: Forms are a vital tool for the webmaster to receive information from the web surfer, such as: their name, email address, credit card, etc. A form will take input from the viewer and depending on your needs; you may store that data into a file, place an order, gather user statistics, register the person to your web forum, or maybe subscribe them to your weekly newsletter Attributes ACTION The ACTION attribute is a URL specifying the location to which the contents of the form are submitted to elicit a response. If the ACTION is missing, the URL for the document itself is assumed. The way data is submitted varies with the access protocol of the URL, and with the values of the METHOD and ENCTYPE attributes. METHOD This specifies variations in the protocol used to send the form contents. It is currently restricted to GET (the default) or POST. The attribute was introduced to inform user agents which HTTP methods the server supports. ENCTYPE This attribute specifies the MIME content type to be used to encode the form contents. It defaults to the string: "application/x-www-form-urlencoded" SCRIPT This can be used to give a URI for a script. The scripting language and the interface with the user agent is not part of the HTML 3.0 specification. A feedback form for Mc Donald customers <html> <body> <form> <center> <font size=20>MC Donald Feedback Form For Customers</center></font><br><br> Name Of Customer:&nbsp;&nbsp;<input type="Text" name="Customer"><br> Address of Customer:<input type=”text” name=”Address”><br> Mobile Number:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input

type="Text" name="Contact"></input><br><br> Select a Country: <select name= Country> <option>America</option> <option>Australia</option> <option>Canada</option> <option>England</option> <option>India</option> <option>Russia</option> </select><br><br> Is MC Donald fulfill Your all Needs<br> <input type="Radio" name="needs">Yes</input><br> <input type="Radio" name="needs">No</input><br><br> Are you satisfy with our service<br> <input type="Radio" name="satisfy">Yes</input><br> <input type="Radio" name="satisfy">No</input><br><br> Any Suggestion About Us : <br> <textarea name="choose" rows="5" cols="50"></textarea><br><br> <input type = "Submit" value="Submit"></input> <input type="Submit" value="Reset"></input></center> </form> </table></html>

Q2. What are various controls used in forms, enumerate with the help of example.
Answers: 1) The Tools toolbar and Tools (Advanced) toolbars are used with Forms to create Windows standard user interface controls. These toolbars are enabled when a Form is the active window. Forms are used to provide user interfaces to scripts, to view tables and for other functions within Manifold.

Frequently Used Controls

Insert Check Box - Inserts check box controls. Insert Option Button - Inserts option button controls. Only one option button in a group may be selected. Insert Command Button - Inserts command button controls. Insert Frame - Draws frame with caption. Frames are used to set off groups of controls, often option buttons. Insert Text Box - Inserts text box. Also called an edit field or edit control. This control can display text entered by the programmer at design time or entered by the user or assigned to the control by other code at run time. Insert Static Text Box - Add a customized text box. Insert List Box - Inserts list box controls. Insert Combo Box - Inserts combo box controls. Insert Horizontal Scroll Bar - Inserts horizontal scroll bar controls. Insert Vertical Scroll Bar - Inserts vertical scroll bar controls.

Q3. How would you add following to web page: a) Submit button

b) Radio button c) Button d) Pull down menus e) Pop ups

Answer: a) Submit button <input type="submit" name="mysubmit" value="Click!"> Name: specifies the identification assigned to this submit button. Value: is the label that appears on the button. The code above will create the submit button as shown below:
Click!

b) Radio button What size pizza? <P> <INPUT TYPE=RADIO NAME="pizzasize" VALUE="S">small<BR> <INPUT TYPE=RADIO NAME="pizzasize" VALUE="M">medium<BR> <INPUT TYPE=RADIO NAME="pizzasize" VALUE="L">large<P> <INPUT TYPE=SUBMIT VALUE="submit"> Output: What size pizza? Small medium large
submit

c) Button <BUTTON ...> creates a button. Unlike <INPUT ...>, <BUTTON ...> is a container which allows you to put regular HTML contents in the button, including text and

pictures. Unfortunately, <BUTTON ...> does not degrade well, and so at this time it's best to stick with <INPUT ...>. this code <BUTTON TYPE=SUBMIT> <IMG SRC="../graphics/sfsmile.gif" HEIGHT=97 WIDTH=105 ALT="Starflower" ALIGN="ABSMIDDLE"> <STRONG>Send It In!</STRONG></BUTTON> produces this

Send It In!

d) 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.

Following is the list of important attributes of <select>:

name: This is the name for the control. size: This can be used to present a scrolling list box. multiple: If set to "multiple" then allows a user to select multiple items from the menu. Following is the list of important attributes of <option>: 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. label: An alternative way of labeling options.

e) 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 To create a popup you'll need the following script: <script language="javascript" type="text/javascript"> function popitup(url) { newwindow=window.open(url,'name','height=200,width=150'); if (window.focus) {newwindow.focus()} return false; } </script>

Part B
Q4. How inline frames are useful. Explain with example.
Answer: An inline frame ("floating frame") is a construct which embeds a document into an HTML document so that embedded data is displayed inside a sub window of the browser's window. This does not mean full inclusion; the two documents are independent, and both them are treated as complete documents, instead of treating one as part of the other Browsers which support I frame display the document referred to by the URL in a sub window, typically with vertical and/or horizontal scroll bars; such browsers ignore the content of the I frame element (i.e. everything between the start tag <iframe...> and the end tag </I frame>). Browsers which do not support iframe (or have such support disabled) do the opposite: process the content as if the <iframe...> and </iframe> tags were not there. Thus, the content matters, despite being ignored by some browsers. See below for notes on designing that content. As a simple example, consider the following situation. We have a site which contains a separately updated newsflashes page, say news.html. We would like to embed that page

into some other page(s) so that the first few lines of its content are directly visible and the rest of it can be viewed by vertical scrolling. This could be written in HTML as follows:

<iframe src="news.html" width="40%" height="80" align="right"> <p>See our <a href="news.html">newsflashes</a>.</p> Browser support Browser to the iframe element is not very wide yet, but increasing:

Internet Explorer has supported iframe since version 3. However, IE as well other browsers have problems in the support, as discussed later in this document. Netscape 6 supports iframe. It has been reported that Netscape 4.7 on Mac has iframe support, but all Netscape 4.x versions on Windows probably lack support. And it has been reported that Mozilla M12 supports iframe. iCab supports it, with a user option to disable the support. WebTV Plus has iframe support, but the "small bugs" include failure to comply with the fundamental idea of using the content of the element only if the inline frame itself is not displayed. Lynx 2.8.2 handles iframe in a manner similar to its treatment of normal frames: it provides a link (preceded by the text IFRAME:) to the document specified in the src attribute of the iframe tag and then renders the content of the iframe element. As the link text, it uses the name attribute if present, otherwise the URL (the src attribute value). Opera 4.0 beta supports iframe, with the option to turn the support off (as independently of normal frame support), and the default setting seems to be to have the support disabled.

Q5. Using suitable example, enumerate the purpose of Global and ass files in ASP.
ANSWER:- 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. The Global.asa file can contain only the following: • Application events • Session events • <object> declarations • TypeLibrary declarations • the #include directive 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

Q6. Write the steps for database connectivity for a web page? Give example.
ANSWER:- Establishing a JDBC database connection in two steps Once you have the correct JDBC driver installed, establishing a JDBC connection from your Java programs to your SQL database is pretty easy. Regardless of whether you're trying to connect to Oracle, SQL Server, MySQL, Postgres, mSQL, or Interbase (or any other JDBC data source), establishing a connection to an SQL database with Java JDBC is a simple two-step process:

 Load the JDBC driver.  Establish the JDBC connection to your database. Two JDBC examples A Mini SQL JDBC example Listing 1 provides the full source code required to establish a JDBC connection to a mSQL database on a server named "www.myserver.com".

/ Establish a connection to a mSQL database using JDBC. import java.sql.*; class JdbcTest1 { public static void main (String[] args) { try { // Step 1: Load the JDBC driver. Class.forName("com.imaginary.sql.msql.MsqlDriver"); // Step 2: Establish the connection to the database. String url = "jdbc:msql://www.myserver.com:1114/contact_mgr"; Connection conn = DriverManager.getConnection(url,"user1","password"); } catch (Exception e) { System.err.println("Got an exception! "); System.err.println(e.getMessage()); } } }