Sim Web

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 61

1

Practical File Of

Web Designing

Submitted To: Mrs. Amandeep kaur Assistant Professor

Submitted by: Simranjit Singh 94972346433

Punjab College of Technical Education

Contents
Serial no. Topics Page No.

1. 2

Introduction to HTML Applications Of HTML Introduction to DHTML CSS Applications of DHTML

3 12 32 33 34 44 45 52 53 54 55 56 57 59

Introduction to Java Script Applications of Java Script Introduction to ASP Features of ASP Global.asa file Variables, Request and Response objects Database Connectivity

5 6

Screenshots of PCTE web Site Screenshots of Blog

3
Introduction to HTML

The purpose of a web browser is to read HTML documents and compose them into
visible web pages. The browser does not display the HTML tags, but uses the tags to interpret the content of the page.

HTML elements form the building blocks of all websites. HTML allows images and objects to be embedded and can be used to create interactive forms. It provides quotes also and a means other to items. Style create structured It can documents by denoting such and structural semantics for text such as headings, paragraphs, lists, links, embed scripts in to define the languages appearance as JavaScript which affect the behavior of HTML WebPages. Web browsers can refer to Cascading Sheets (CSS) layout of text and other material.

Features Of HTML

Lets you embed Perl code into HTML documents. Perl code is evaluated at the server side and the result is sent to the browser. Offers various meta-commands for conditional and loop processing of the HTML documents.

Automatically generates dynamic HTML tables/lists from Perl arrays or function calls (e.g. DBI fetch) Form data send to your document is placed in a hash Automatically inserts data from the form hash into HTML input, textarea and select tags Understands HTML and URL escaping and unescaping Handles per-user and per-module persistent session data for you. All you need to do is store and retrieve them to and from a special hash.

Allows you to build your web-site out of components. Frequently used elements can be defined once and included in every page. Object allows you to define the standard layout of your site just once and includes the necessary components based on the uri. Your HTML documents just have to contain the unique stuff and not the common stuff like headers/footers or navigation bars. Also these common elements can be overwritten in each subdirectory. Gives you the possibility to build libraries with a set of frequently used Elements or components, and make them available to the whole web-site in the same way as Perl modules are - well, modularized. Supports debugging of pages by generating a very detailed log file and making it accessible via the browser with a single click. Generates verbose error pages in which every error can link to the log file. This is ideal for debugging. Offers a lot of options for maximum configurability according to your personal tastes and needs. Fully integrated into Apache and mod_perl to acheive the best performance. Can also run as a CGI-script, offline or called from another Perl program. HTML:Mail gives you the possibility to send the result directly to a email address

HTML Tags
Tag <!-<a <b> <big> <body> Name comment anchor bold big (text) body of HTML document line break center Code Example <!--This can be viewed in the HTML part of a document--> <a href="http://www.domain.com/"> Visit Our Site</a> <b>Example</b> <big>Example</big> <body>The content of your HTML page</body> The contents of your page<br>The contents of your page <center>This will center your contents</center>

<br> <center>

<dd>

<dl> <dt>Definition Term</dt> definition <dd>Definition of the term</dd> description <dt>Definition Term</dt> <dd>Definition of the term</dd> </dl> <dl> <dt>Definition Term</dt> <dd>Definition of the term</dd> <dt>Definition Term</dt> <dd>Definition of the term</dd> </dl> <dl> <dt>Definition Term</dt> <dd>Definition of the term</dd> <dt>Definition Term</dt> <dd>Definition of the term</dd> </dl> This is an <em>Example</em> of using the emphasis tag <embed src="yourfile.mid" width="100%" height="60" align="center"> <embed src="yourfile.mid" autostart="true" hidden="false" loop="false"> <noembed><bgsound src="yourfile.mid" loop="1"></noembed> <font face="Times New Roman">Example</font> <font face="Times New Roman" size="4">Example</font> <font face="Times New Roman" size="+3" color="#ff0000">Example</font>

<dl>

definition list

<dt>

definition term

<em> <embed>

emphasis embed object embed object font font font

<embed>

<font> <font> <font>

6
<form action="mailto:you@yourdomain.com"> Name: <input name="Name" value="" size="10"><br> Email: <input name="Email" value="" size="10"><br> <center><input type="submit"></center> </form> 1 2 3 4 5 6 <h1>Heading <h2>Heading <h3>Heading <h4>Heading <h5>Heading <h6>Heading 1 2 3 4 5 6 Example</h1> Example</h2> Example</h3> Example</h4> Example</h5> Example</h6>

<form>

form

<h1> <h2> <h3> <h4> <h5> <h6> <head>

heading heading heading heading heading heading

heading of HTML document horizontal rule horizontal rule horizontal rule horizontal rule horizontal rule

<head>Contains elements describing the document</head> <hr /> <hr width="50%" size="3" /> <hr width="50%" size="3" noshade />

<hr> <hr> <hr> <hr> (Internet Explorer) <hr> (Internet Explorer)

<hr width="75%" color="#ff0000" size="4" />

<hr width="25%" color="#6699ff" size="6" /> <html> <head> <meta> <title>Title of your web page</title> </head> <body>HTML web page contents </body> </html> <i>Example</i> <img src="Earth.gif" width="41" height="41" border="0" alt="text describing the image" /> Example 1:

<html>

hypertext markup language

<i> <img>

italic image

<input>

input field

<form method=post action="/cgi-bin/example.cgi"> <input type="text" size="10" maxlength="30"> <input type="Submit" value="Submit"> </form> Example 2: <form method=post action="/cgi-bin/example.cgi"> <input type="text" style="color: #ffffff; font-family: Verdana; font-weight: bold; font-size: 12px; background-color: #72a4d2;" size="10" maxlength="30"> <input type="Submit" value="Submit"> </form> Example 3:

<input> (Internet Explorer)

input field

<input>

input field

7
<form method=post action="/cgi-bin/example.cgi"> <table border="0" cellspacing="0" cellpadding="2"><tr><td bgcolor="#8463ff"><input type="text" size="10" maxlength="30"></td><td bgcolor="#8463ff" valign="Middle"> <input type="image" name="submit" src="yourimage.gif"></td></tr> </table> </form> Example 4: <form method=post action="/cgi-bin/example.cgi"> Enter Your Comments:<br> <textarea wrap="virtual" name="Comments" rows=3 cols=20 maxlength=100></textarea><br> <input type="Submit" value="Submit"> <input type="Reset" value="Clear"> </form> Example 5: <form method=post action="/cgi-bin/example.cgi"> <center> Select an option: <select> <option >option 1</option> <option selected>option 2</option> <option>option 3</option> <option>option 4</option> <option>option 5</option> <option>option 6</option> </select><br> <input type="Submit" value="Submit"></center> </form> Example 6: <form method=post action="/cgi-bin/example.cgi"> Select an option:<br> <input type="radio" name="option"> Option 1 <input type="radio" name="option" checked> Option 2 <input type="radio" name="option"> Option 3 <br> <br> Select an option:<br> <input type="checkbox" name="selection"> Selection 1 <input type="checkbox" name="selection" checked> Selection 2 <input type="checkbox" name="selection"> Selection 3 <input type="Submit" value="Submit"> </form> Example 1: <menu> <li type="disc">List item 1</li> <li type="circle">List item 2</li> <li type="square">List item 3</li> </MENU> Example 2:

<input>

input field

<input>

input field

<input>

input field

<li>

list item

8
<ol type="i"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> </ol> <head> <link rel="stylesheet" type="text/css" href="style.css" /> </head> <marquee bgcolor="#cccccc" loop="-1" scrollamount="2" width="100%">Example Marquee</marquee>

<link>

link

<marquee> (Internet Explorer) <ol>

scrolling text

ordered list Numbered <ol> <li>List <li>List <li>List <li>List </ol> item item item item 1</li> 2</li> 3</li> 4</li>

Numbered Special Start <ol start="5"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> </ol> Lowercase Letters <ol type="a"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> </ol> Capital Letters <ol type="A"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> </ol> Capital Letters Special Start <ol type="A" start="3"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> </ol> Lowercase Roman Numerals <ol type="i">

<li>List <li>List <li>List <li>List </ol>

item item item item

1</li> 2</li> 3</li> 4</li>

Capital Roman Numerals <ol type="I"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> </ol> Capital Roman Numerals Special Start <ol type="I" start="7"> <li>List item 1</li> <li>List item 2</li> <li>List item 3</li> <li>List item 4</li> </ol> <form method=post action="/cgi-bin/example.cgi"> <center> Select an option: <select> <option>option 1</option> <option selected>option 2</option> <option>option 3</option> <option>option 4</option> <option>option 5</option> <option>option 6</option> </select><br> </center> </form> This is an example displaying the use of the paragraph tag. <p> This will create a line break and a space between lines. Attributes: <p align="left"> Example 1:<br /> <br /> This is an example<br> displaying the use<br> of the paragraph tag.</p> <p align="right"> Example 2:<br> <br> This is an example<br> displaying the use<br> of the paragraph tag.</p> <p align="center"> Example 3:<br> <br> This is an example<br> displaying the use<br> of the paragraph tag.</p>

<option>

listbox option

<p>

paragraph

10
<small> <strike> <strong> small (text) <small>Example</small> deleted text strong emphasis <strike>Example</strike> <strong>Example</strong> Example 1: <table border="4" cellpadding="2" cellspacing="2" width="100%"> <tr> <td>Column 1</td> <td>Column 2</td> </tr> </table> Example 2: (Internet Explorer) <table border="2" bordercolor="#336699" cellpadding="2" cellspacing="2" width="100%"> <tr> <td>Column 1</td> <td>Column 2</td> </tr> </table> Example 3: <table cellpadding="2" cellspacing="2" width="100%"> <tr> <td bgcolor="#cccccc">Column 1</td> <td bgcolor="#cccccc">Column 2</td> </tr> <tr> <td>Row 2</td> <td>Row 2</td> </tr> </table> <table border="2" cellpadding="2" cellspacing="2" width="100%"> <tr> <td>Column 1</td> <td>Column 2</td> </tr> </table> <div align="center"> <table> <tr> <th>Column 1</th> <th>Column 2</th> <th>Column 3</th> </tr> <tr> <td>Row 2</td> <td>Row 2</td> <td>Row 2</td> </tr> <tr> <td>Row 3</td> <td>Row 3</td> <td>Row 3</td>

<table>

table

<td>

table data

<th>

table header

11
</tr> <tr> <td>Row 4</td> <td>Row 4</td> <td>Row 4</td> </tr> </table> </div> <title> document title <title>Title of your HTML page</title> <table border="2" cellpadding="2" cellspacing="2" width="100%"> <tr> <td>Column 1</td> <td>Column 2</td> </tr> </table> <tt>Example</tt> <u>Example</u> Example 1:<br> <br> <ul> <li>List item 1</li> <li>List item 2</li> </ul> <br> Example 2:<br> <ul type="disc"> <li>List item 1</li> <li>List item 2</li> <ul type="circle"> <li>List item 3</li> <li>List item 4</li> </ul> </ul>

<tr>

table row

<tt> <u>

teletype underline

<ul>

unordered list

12

Applications OF HTML

13

1. Application To print text in HTML

Code To implement :

14

<html> <head> <title> Web </title> <head> <body> My First Web Page </body> </html>

2. Application to display different Kinds of headings in HTML.

15

Code To implement : <html> <body> <h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3> <h4>This is heading 4</h4> <h5>This is heading 5</h5> <h6>This is heading 6</h6> </body> </html>

16

3. Application for creating the Link in Html.

When we will click on Click here it will show list of subjects.

17

Code To implement : <html> <body><h2> <center><br> <a href="list.html" target="_blank" >Click here </a>to view List of subjects of BCA </center></h2></body></html> Save this file using any name with .html extension and create new html document. <html> <body> <center> <pre>

18

<h1 > Subjects</h1><br> <u><b>1st Sem</b></u><br> maths c communication IT <br> <u><b> 2nd sem</b></u> <br> Data structure microprocessor CSA<br> <u><b>3rd Sem</b></u> <br> java c++ OR </body> </html>

19

4. Application to increase size , change the color , font style of text.

20

Code To implement : <html> <body> <p> <font size="10" face="Monotype Corsiva" color="red"> This paragraph is in Monotype Corsiva , size 10, and in red text color. </font> </p> </body> </html>

21

5. Application for creating Table in HTML.

Code To implement : <html> <head><title> Table </title> </head> <body> <table bgcolor="#FFF8C6" border=6 cellspacing="5" cellpadding 10 align="center"> <tr>

22

<th rowspan=2 bgcolor=pink>name <th colspan =3 bgcolor=pink>marks </tr> <tr> <th bgcolor=pink> c <th bgcolor=pink> web designing <th bgcolor=pink> java </tr> <tr> <td > Divam <td >16 <td >50 <td >40 </tr> <tr> <td >Abc <td >16 <td >50 <td >40 </tr> <tr> <td >Def <td >16 <td >50 <td >40 </tr> <tr> <td > Ghi <td >16 <td >50

23

<td >40 </tr><tr> <td >jkl <td >16 <td >60 <td >70 </tr><tr> <td >Mno <td >16 <td >40 <td >35 </tr> </table></html>

24

6. Application to implement lists in HTML.

Code To implement : <html> <body > <h1 align="center"> Subjects</h1> <ol start="1" type="I">

25

<li>1st Sem <ul> <li>maths <li>c <li>communication <li>IT </ul> <li> 2nd sem <ul> <li>Data structure <li>microprocessor <li>Computer System Architecture </ul> <li>3rd Sem <ul> <li>java <li>c++ <li>OR </ul> </li> <dl><br> <dt><u>Practical Subjects</u></dt> <dd>There will be practical exams for some subjects like c, c++, java.To be sure, the performance-based methodologies rolled out by certification programs.g. The certification programs that have included experiential learning in their curricula

26

deserve commendation for raising the standards of IT credentials by making them more applicable to the industry. <dt> </dd> </body> </html>

27

7. Web site using Frames.

Code To implement : <html> <head><title>Frame</title></head>

28

<frameset rows="22%,2%,2%,64%,2%,*"> <frameset cols="20%,50%,*"> <frame name="son" src="a.html" noresize scrolling="no"> <frame name="ttl" src="ttl.htm" noresize scrolling="no"> <frame name="flow" src="stu.html" noresize scrolling="no"> </frameset> <frameset cols="*"> <frame name="z" src="z.html" > </frameset> <frameset cols="*"> <frame name="bg" src="bg.html" > </frameset> <frameset cols="20%,*" > <frame name="lin" src="lin.htm" noresize> <frame name="info" src="pp.html" scrolling="no"> </frameset> <frameset cols="*"> <frame name="son" src="abc.html" noresize scrolling="no"> </frameset> <frameset cols="*"> <frame name="Divam " src="ab.html" noresize scrolling="no">

29

</frameset>

8.Image Map in HTML


Map Of Goa

Click on Betul. It will show the following map:

30

Map of Betul

Click on Old Goa, it will show the following map.

31

Map of Old Goa

32

Code:
<html> <head><title> Map</title></head> <body bgcolor="green" text=blacl> <h2 align=center> <u>Map of Goa</u> </h2> <map name="goa"> <area title="Map of Betul" shape="circle" coords=300,275,10 href="betul.jpg" > <area title="Map of quepum" shape="rect" coords=50,200,70,235 href="quepem.jpg"> <area title="Map of Arambol" shape="circle" coords=190,30,7 href="arambol.jpg"> <area title="Map of old goa" shape="circle" coords=320,100,15 href="OldGoa.jpg"> </map> <pre> </body> </html> <img align="center" src="map_of_goa.jpg" usemap="#goa" hspace=240>

DHTML

33 DHTML is not a language itself, but rather a combination of: HTML 4.0 (or XHTML 1.0) JavaScript -- the Web's standard scripting language Cascading Style Sheets (CSS) -- styles dictated outside a document's content Document Object Model (DOM) -- a means of accessing a document's individual elements

Since the first edition of this book, Dynamic HTML has developed into a stable standard that is well supported by both Netscape 6 and Internet Explorer 5.5. Netscape Navigator 4.0 and IE 4.0 supported earlier, proprietary versions of DHTML, and they differed greatly in their support for CSS and dynamically positioned elements. The differences between what these two browser versions called DHTML has created a million migraines among web developers. Accounting for the inconsistencies required creating two separate web pages or jumping through browser-detection hoops to give all users the same experience

HTML stands for Dynamic HTML. The first thing that we need to clear about DHTML is that it is neither a language like HTML, JavaScript etc. nor a web standard. It is just a combination of HTML, JavaScript and CSS. It just uses these languages features to build dynamic web pages. DHTML is a feature of Netscape Communicator 4.0, and Microsoft Internet Explorer 4.0 and 5.0 and is entirely a "client-side" technology. Features of DHTML:

Simplest feature is making the page dynamic. Can be used to create animations, games, applications, provide new ways of navigating through web sites. DHTML use low-bandwidth effect which enhance web page functionality. Dynamic building of web pages is simple as no plug-in is required. Facilitates the usage of events, methods and properties and code reuse.

CSS

34

CSS is a formatting language, used to provide more customized web pages and make it easier to make multiple pages use the same style. Its most common application is to style web pages written in HTML and XHTML, but the language can also be applied to any kind of XML document, including plain XML, SVG and XUL.

Two ways to include CSS on a page


One way is by loading it from an external file Other way is by embedding it directly in the source code of the page.

Applications Of DHTML

35

1) Application to show the use of comments in CSS.

Code to implement:

36

<html> <head> <style type="text/css"> H1{text-align:center; bgcolor:red; background-color:yellow; color:black;/*This is a comment*/ font-family:Monotype Corsiva; font-size:50;} </style></head> <body><br><hr> <h1>Simran<h1><hr> </body></html>
.

37

2. Application to change the text Decoration in CSS.

Code to implement:

38

<html> <head> <style type="text/css"> h1 {text-decoration:overline;} h2 {text-decoration:line-through;} h3 {text-decoration:underline;} h4 {text-decoration:blink;} </style></head> <body> <h1>Simran</h1> <h2> Simran </h2> <h3> Simran </h3> <h4> Simran </h4> </body> </html>

3. Application to show working of Inline CSS.

39

Code to implement:

40

<html> <body> <h1 style="color:red;background-color:yellow;font-family:Arial;fontsize:"20px">Simran </h1> <h1 style="color:red;background-color:Yellow;font-family:Arial;fontsize:"20px">BCA- 3D</h1> </body> </html>

4. Application to show working of Internal CSS.

41

Code to implement: <html> <style type="text/css"> h1 { color:red; background-color:yellow; font-family:Arial; font-size:"12px"; } </style> <body>

42

<h1>Punjab College Of Technical Education</h1> <h1>Baddowal</h1> </body> </html>

5. Application to change the color of the text in CSS

43

44

Code to implement: <html> <head> <style type="text/css"> body {color:red;} h1 {color:#00ff00;} p.ex {color:rgb(0,0,255);} </style> </head> <body> <h1> Simran </h1> <p>I am student of Punjab college of Technical Education.</p> <p class="ex">This is a paragraph with class="ex". This text is blue.</p> </body> </html>

45

Introduction to Java Script

JavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a paradigm language, supporting object-oriented, imperative, and functional. Programming styles. JavaScript was formalized in the ECMA Script language standard and is primarily used in the form of client-side JavaScript, implemented as part of a Web browser in order to provide enhanced user interfaces and dynamic websites. This enables programmatic access to computational objects within a host environment. JavaScript's use in applications outside Web pages for example in PDF documents, site-specific browsers, and desktop widgets is also significant. JavaScript uses syntax influenced by that of C. JavaScript copies many names and naming conventions from Java, but the two languages are otherwise unrelated and have very different semantics.

Features
JavaScript supports much of the structured programming syntax from C . style block-level scoping is not supported .JavaScript makes a distinction between expressions and statements. JavaScript is almost entirely object-based. JavaScript objects are associative arrays, augmented with prototypes. JavaScript has a small number of built-in objects such as Function and Date. Functions are first-class; they are objects themselves. As such, they have properties and methods, such as length and call and they can be assigned to variables, passed as arguments, return by other functions, and manipulated like any other object. JavaScript uses prototypes instead of classes for inheritance. It is possible to simulate many class-based features with prototypes in JavaScript.

46

Applications Java Script


1.

Application to display the date and time.

Code to implement <html> <head> <body> <script type="text/javascript"> document.write("<b><u>"+Date()+"</b></u>"); </script> </body>

47

</html>
2.

Application to add two numbers.

Code to implement <html> <head> <script type="text/javascript"> function sum(a,b) { return a+b; }</script></head> <body> <script type="text/javascript"> document.write(sum(4,3)); </script> </body> </html

48

3. Application to show the live clock

Code to implement : <html> <head> <script type="text/javascript"> function clock() { var d=new Date(); var h=d.getHours(); var m=d.getMinutes(); var s=d.getSeconds(); document.getElementById('clk').innerHTML=h+":"+m+":"+s; t=setTimeout('clock()',500);

49

} </script> </head> <body onload="clock()"> <div id="clk"> </div> </body></html>

50

4.

Application to show an alert Box.

Code to implement: <html> <head> <script type="text/javascript"> function show() { alert("Going to delete it"); } </script> </head> <body onload="show()"> </body> </html>

51

5.

Application to show a confirm box.

Click on Save.

52

Code to implement <html> <head> <script type="text/javascript"> function show() { var r=confirm("Are you sure you want to make changes ?"); } </script> </head> <body> <input type="button" onclick="show()" value="save" > </body> </html>

53

Introduction to ASP
"Active Server Pages" abbreviated as ASP, is a server-side scripting environment developed by Microsoft. Using ASP, we can create and run dynamic and interactive web server applications. With ASP, we can combine HTML pages, script commands, and COM components to create interactive Web pages or powerful Web-based applications, which are easy to develop and modify. The default scripting language used for writing ASP is VBScript although we can use JavaScript. All ASP pages will be executed at the server and the page will have the extension ".asp". An ASP page cannot run by simply opening it in a web browser. The page must be requested through a web server that supports ASP, this is why ASP stands for Active Server Pages, no server, no active pages. When a browser requests an ASP page, the web server interprets any ASP contained within the web page before sending the HTML produced to the browser In this way, the entire ASP is run on the web server and no ASP will ever be passed back to the web browser.

54

Features
1) Active Server Pages can develop a new generation of Web-based applications, including extending sales and customer service to the Web, and providing access to corporate databases and applications to any browser on an intranet. 2) Active Server Pages allows organizations to extend the power of scripting on the server with ActiveX server components. These components can be created using Microsoft Visual Basic, Visual C++, Java, and other languages. 3) Active Server Pages provides native support for both Microsoft JScript and VBScript. ActiveX scripting plug-ins are available for REXX, PERL, and Python. 4) Active Server Pages can work with any Web browser. The output of an ASP file is plain HTML, the content of which can be customized for the capabilities of the client. 5) Active Server Pages allows you to define application and session variables that can be carried across multiple pages in a Web site. This can be as simple as remembering a user's name, and it is necessary in applications such as online shopping to track product selections. 6) Active Server Pages makes it easy to bring legacy database applications to the Web.

IIS - Internet Information Server


IIS is a set of Internet-based services for servers created by Microsoft for use with Microsoft Windows. IIS comes with Windows 2000, XP, Vista, and Windows 7. It is also available for Windows NT. IIS is easy to install and ideal for developing and testing web applications. With IIS, Microsoft includes a set of programs for building and administering Web sites, a search engine, and support for writing Web-based applications that access databases. Microsoft points out that IIS is tightly integrated with the Windows NT and 2000 Servers in a number of ways, resulting in faster Web page serving.

55

How to install PWS on Windows 95, 98, and Windows NT For Windows 98: Open the Add-ons folder on your Windows CD, find the PWS folder and runsetup.exe to install PWS. For Windows 95 or Windows NT: Download "Windows NT 4.0 Option Pack" from Microsoft, and install PWS. Test your web : After you have installed IIS or PWS follow these steps: Look for a new folder called Inetpub on your hard drive. Open the Inetpub folder, and find a folder named wwwroot. Create a new folder, like "My Web", under wwwroot. Write some ASP code and save the file as "test1.asp" in the new folder. Make sure your Web server is running. Open your browser and type "http://localhost/MyWeb/test1.asp", to view your first web

The Global.asa file


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

56

<object> declarations TypeLibrary declarations the #include directive

Variables
A variable declared outside a procedure can be accessed and changed by any script in the ASP file. To declare variables accessible to more than one ASP file, declare them as session variables or application variables. Session Variables: Session variables are used to store information about one single user, and are available to all pages in one application. Typically information stored in session variables is name, id, and preferences. Application Variables: Application variables are also available to all pages in one application. Application variables are used to store information about all users in one specific application.

Request, Response Objects


Request and Response objects represent information coming into the Web server from the browser and information going out from the server to the browser. The Request object is called the input object and the Response object is called the output object. Response Object: The Response object methods gives us control over what you can send to the client from the web server. However, one of the most valuable uses for the Response object is in debugging your scripts. The Response object is used to send output to the client from the web server. Request Object: The Request object retrieves the values that the client browser passed to the server during an HTTP request. It is used to get information from the user. Using this object, you can dynamically create web pages and perform various server-side actions based on input from the user.

57

Cookie
A cookie is often used to identify a user. A cookie is a small file that the server embeds on the user's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With ASP, you can both create and retrieve cookie values. o The "Response.Cookies" command is used to create cookies. o The "Request.Cookies" command is used to retrieve a cookie value.

Database Connectivity
The common way to access a database from inside an ASP page is to: 1. Create an ADO connection to a database. 2. Open the database connection. 3. Create an ADO recordset. 4. Open the recordset. 5. Extract the data you need from the recordset. 6. Close the recordset. 7. Close the connection.

Connection Object
The ADO Connection Object is used to create an open connection to a data source. Through this connection, you can access and manipulate a database. If you want to access a database multiple times, you should establish a connection using the Connection object. You can also make a connection to a database by passing a connection string via a Command or Recordset object.

58 The easiest way to connect to a database is to use a DSN-less connection. A DSN-less connection can be used against any Microsoft Access database on your web site. If you have a database called "web.mdb" located in a web directory like "c:/webdata/", you can connect to the database with the following ASP code: <%set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "c:/webdata/web.mdb"%>

Screenshots of PCTE Web Site


Home Page

59

Contact Us Page

60

Screenshots of Blog
Home Page

61

You might also like