BCA Web Design Lab Guide
BCA Web Design Lab Guide
Contents
1
.Introduction to HTML. Create a basic HTML file......................3
2.Create a static webpage using table tags of HTML...................5
3.Create a static web page which defines all text formatting tags of
HTML in tabular format...............................................7
4.Create webpage using list tags of HTML.............................9
5.Create webpage to include image using HTML tag....................11
6.Create employee registration webpage using HTML form objects......12
7.Apply style sheet in Web page. [inline, embedded and linked]......14
8.Create a simple xml file and also create dynamic web page in which
XML tags used.......................................................15
9.Create a dynamic web page which displays arithmetic operations
[addition, subtraction, division, multiplication and modulus] using
HTML Frame..........................................................16
10.Write a script which creates and retrieves Cookies information. . .18
11.Introduction to Global.asa file and it's firing sequence.........19
12.Write a suitable script which creates and retrieves Application and
Session Variables...................................................20
13.Create a dynamic web page which displays Ads using AdRotator
Component...........................................................22
14.Create a dynamic web page which displays capabilities of a web
browser using Browser Capabilities Component........................24
15.Introduction to ADO objects and adovbs.inc file..................27
16.Introduction to DSN. Create System DSN Connection for web
application.........................................................33
17.Write a suitable script which displays records from the database. 35
18.Write a script which inserts the record into the database........37
19.Write a script which update the record into the database.........39
20.Write a script which deletes the record from the database........40
2
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 1
HTML is a text document with formatting codes and this document has
the suffix “.html” or “.htm”.
3
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
4
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 2
<html>
<body>
<TABLE BORDER="1" CELLPADDING="2">
<CAPTION ALIGN="Top"><b>Specification Table with Hours and
Marks<CAPTION>
<TR>
<TH ROWSPAN="2">Unit No.</TH>
<TH ROWSPAN="2">Unit Title</TH>
<TH ROWSPAN="2">Teaching Hours</TH>
</TR> <TH Colspan="4">Distribution of Theory Marks</TH>
<TR>
<TD><center>14</TD>
</TR>
<TR>
<TD> <center>V </TD>
<TD>ASP Objects & Components</TD>
<TD><center>10</TD>
<TD><center>4</TD>
<TD><center>4</TD>
<TD><center>6</TD>
</TR> <TD><center>14</TD>
<TR>
<TD> </TD>
<TD><center><b>Total</TD>
<TD><center><b>42</TD>
<TD><center><b>18</TD>
</tr> <TD><center><b>26</TD>
</TABLE> <TD><center><b>26</TD>
</body> <TD><center><b>70</TD>
</html>
OUTPUT
6
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 3
Create a static web page which defines all text formatting tags of HTML in tabular format
<html>
<body>
<center>
<table border=1>
<caption align="top"><font size="+2" color="red">Text Formatting
Tags</font> </caption>
<tr>
<th>HTML Tag</th>
<th>Output</th>
</tr>
<tr>
<td>normal text</td>
<td>hello world</td>
</tr>
<tr>
<td>Font & its attributes</td>
<td><FONT SIZE="+2" COLOR="#RRGGBB"> hello world
</FONT></td>
</tr>
<tr>
<td><B></td>
<td><B> Bold </B></td>
</tr>
<tr>
<td><I></td>
<td><I> Italic </I></td>
</tr>
<tr>
<td><U></td>
<td><U> Underline </U></td>
</tr>
<tr>
<td><EM></td>
<td><EM> Emphasis </EM></td>
</tr>
<tr>
<td><STRONG></td>
<td><STRONG> STRONG </STRONG></td>
</tr>
<tr>
<td><TELETYPE></td>
<td><TT> TELETYPE </TT></td>
</tr>
<tr>
<td><CITE></td>
<td><CITE> Citation </CITE></td>
</tr>
<tr>
<td><STRIKE></td>
<td><STRIKE> strike-through text </STRIKE></td>
</tr>
7
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
<tr>
<td><BIG></td>
<td><BIG> text in a big font </BIG></td>
</tr>
<tr>
<td><SMALL></td>
<td><SMALL> text in a small font <SMALL></td>
</tr>
<tr>
<td><SUB></td>
<td>a<SUB> b </SUB></td>
</tr>
<tr>
<td><SUP></td>
<td>a<SUP> b</SUP></td>
</tr>
</table>
</body>
</html>
OUTPUT
8
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 4
<html>
<body>
<b> HTML List: Ordered, Unordered & Definition List</b>
<hr>
<OL type=1>
<li>Develop programs related with unit vice topics in computer
laboratory.</li>
<li>Develop any module of to be useful in real life application.</li>
<li>Multimedia presentation of module developed by students.</li>
</OL>
<hr>
<UL>
<li><u>ASP Tutorial - W3Schools</u><br>
<a href=http://www.w3schools.com/asp/> www.w3schools.com/asp</a></li>
<li><u>Classic ASP Tutorials & Articles - Web Wiz</u><br>
<a href="http://www.webwiz.co.uk">www.webwiz.co.uk -
Knowledgebase</a></li>
<li><u>HTML Tutorial - W3Schools</u><br>
<a href="http://www.w3schools.com/html/">
www.w3schools.com/html</a></li>
<li><u>CSS Tutorial</u><br>
<a href="http://www.csstutorial.net/"> www.csstutorial.net</a></li>
<li><u>VBScript Tutorial - Tutorials Point</u><br>
<a href="http://www.tutorialspoint.com/vbscript/index.htm">
www.tutorialspoint.com/vbscript/index.htm</a></li>
<li><u>ADO Tutorial - W3Schools</u><br>
<a href="http://www.w3schools.com/ADO/default.asp">
www.w3schools.com/ADO/default.asp</a></li>
</UL>
<hr>
<DL> <DT>HTML</DT>
<DD>Hyper Text Markup Language</DD>
<DT>XML</DT>
<DD>eXtensible Markup Language</DD>
</DL>
</body>
</html>
9
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
OUTPUT
10
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 5
<html>
<body background="Desert.jpg">
<center><img src="dns.gif">
</body>
</html>
11
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 6
Create employee registration webpage using HTML form objects
<html>
<body>
<Center>
<img src="employee_icon.png" height=52 width=52>
<Font size="+3" color=red>Employee Registration Form</font>
<form method=post action="prac.html">
<table>
<tr>
<td></td>
<td><input type=radio name=initial checked>Mr.
<input type=radio name=initial>Mrs.
<input type=radio name=initial>Ms.</td>
</tr><tr>
<td>First Name</td>
<td><input type=text name=fn placeholder="First Name"></td>
</tr><tr>
<td>Last Name</td>
<td><input type=text name=ln placeholder="Last Name"></td>
</tr> <tr>
<td>Mail Address1</td>
<td><input type=text name=add1></td>
</tr><tr>
<td>Mail Address2</td>
<td><input type=text name=add2></td>
</tr><tr>
<td>City</td>
<td><input type=text name=ct></td>
</tr><tr>
<td>State</td>
<td><select name=state>
<option value="Gujarat">Gujarat
<option value="Maharastra">Maharastra
<option value="Karnataka">Karnataka
<option value="Delhi">Delhi
</select>
</td>
</tr><tr>
<td>Zip</td>
<td><input type=text name=zp></td>
</tr><tr>
<td>Upload Photo</td>
<td><input type=file name=photo></td>
</tr><tr>
<td>E-Mail</td>
<td><input type=text name=email size=30></td>
</tr><tr>
<td>Mobile</td>
<td><input type=text name=mob placeholder="+91"></td>
</tr><tr>
<td>Languages known</td>
<td><input type=checkbox name=lk value=Gujarati checked>Gujarati</td>
12
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
</tr><tr>
<td></td>
<td><input type=checkbox name=lk value=Hindi checked>Hindi</td>
</tr><tr>
<td></td>
<td><input type=checkbox name=lk value=English checked>English</td>
</tr><tr>
<td></td>
<td><input type=checkbox name=lk value=Marathi >Marathi</td>
</tr><tr>
<td>Additional Information</td>
<td><textarea name=add rows=3 cols=20 placeholder="Optional"
wrap></textarea></td>
</tr><tr>
<td></td>
<td><input type=submit value=submit> <input type=reset
value=reset></td>
</table>
</form>
</body>
</html>
OUTPUT
13
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 7
Apply style sheet in Web page. [inline, embedded and linked]
ext.css
hr
{
color:sienna;
}
p
{ margin-left:20px;
}
body background-image:url("sheet.jpg");
{
}
stylesheet.html
<html>
<head>
<link rel="stylesheet" type="text/css" href="ext.css">
<style> h1
{
background-color:#6495ed;
}
p
{ background-color:#e0ffff;
}
div background-color:#b0c4de;
{
}
</style>
</head>
<body>
14
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
OUTPUT
PRACTIAL 8
Create a simple xml file and also create dynamic web page in which XML tags used
Simple XML file: name.xml
<Name>
<First> Sachin </First>
<Last> Tendulkar </Last>
</Name>
XML with ASP: name.asp
To generate an XML response from the server - simply write the
following code and save it as an ASP file on the web server.
<%
response.ContentType="text/xml"
response.Write("<?xml version='1.0' encoding='ISO-8859-'?>")
response.Write("<Name>") response.Write("<First>Sachin</First>")
response.Write("<Last>Tendulkar</Last>") response.Write("</Name>")
%>
15
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 9
Create a dynamic web page which displays arithmetic operations [addition, subtraction,
division, multiplication and modulus] using HTML Frame
frame.asp
<Html>
<frameset rows="50%, 50 %">
<frame src="Form.asp" name="que">
<frame src="Answer.asp" name="ans">
</frameset>
</html>
Form.asp
<%@ language= vbscript %>
<% option explicit %>
<Html>
<body>
<form method=post action="answer.asp" target="ans">
<b><center><u><font color=red size=4>Arithmetic Operations</font>
</u></b></center><br><br><br>
<table align=center border=0>
<tr>
<td><b>Enter First Number:</td>
<td><input type=text name=n1 placeholdder="First Number"></td>
</tr>
<tr>
<td><b>Enter Second Number:</td>
<td><input type=text name=n2 placeholdder="Second Number"></></td>
</tr>
<tr>
<td><b>Select Your Choice:</td>
<td><select name=opr>
<option value="Addition">Addition
<option value="Subtraction">Subtraction
<option value="Division">Division
<option value= "Multiplication"> Multiplication
<option value="Modulus">Modulus
</select>
</td>
</tr>
</table><Br>
<center> <input type = submit value="submit"> </center>
</form>
</body>
</html>
Answer.asp
<html>
<body>
<% dim a, b, c a=request ("n1")
16
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
Case "Modulus"
response.write "Modulus of "
response.write a response.write " & " response.write b
response.write " is " response.write (a mod b)
End select
%>
</font>
</center>
</body>
</html>
17
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 10
18
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 11
Example
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
'Set our user count to 0 when we start the server Application
("ActiveUsers") = 0
End Sub
Sub Session_OnStart
'Change Session Timeout to 20 minutes (if you need to)
Session.Timeout = 20
Set a Session Start Time
this is only important to assure we start a session Session ("Start")
= Now
'Increase the active visitors count when we start the session
Application.Lock
Application("ActiveUsers")=Application ("ActiveUsers")+1
Application.UnLock
End Sub
Sub Session_OnEnd
‘Decrease the active visitors count when the session ends.
Application.Lock
Application("ActiveUsers")= Application("ActiveUsers")-1
Application.UnLock
End Sub
</SCRIPT>
Application_OnStart: Occurs when the FIRST user calls the first page
in an ASP application. This event occurs after the Web server is
restarted or after the Global.asa file is edited. The
"Session_OnStart" event occurs immediately after this event.
Session_OnStart - This event occurs EVERY time a NEW user requests his
or her first page in the ASP application.
Session_OnEnd - This event occurs EVERY time a user ends a session. A
user-session ends after a page has not been requested by the user for
a specified time.
Application_OnEnd - This event occurs after the LAST user has ended
the session. Typically, this event occurs when a Web server stops.
This procedure is used to clean up settings after the Application
19
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
20
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 12
Write a suitable script which creates and retrieves Application and Session Variables
Application Variable
In this 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
Sub Session_OnEnd
Application.Lock Application("visitors")=Application("visitors")-1
Application.UnLock
End Sub
</script>
<html>
<body>
There are
<%response.write(Application("visitors"))%> online now..
</body>
</html>
21
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
Session Variable
<html>
<body>
Welcome
<% Response.Write(Session("username"))%>
</body>
</html>
OUTPUT
Welcome bbit
22
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 13
Create a dynamic web page which displays Ads using AdRotator Component
Note: This practical works with IIS 5.0 & 6.0 and will not works with
IIS 7.0 or above.
AdRotator.asp
<% option explicit %>
<%
Dim objad
Set objad = server.createobject ("MSWC.adrotator")
%>
<Html>
<Body>
<Center>
<%= objad.getadvertisement ("AdRotator.txt") %>
</Center> <Br><hr>
<Center>
<%= objad.getadvertisement ("AdRotator.txt") %>
</Center>
23
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
OUTPUT
24
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 14
Create a dynamic web page which displays capabilities of a web browser using Browser
Capabilities Component
</TD>
<TD> <%= objBC.platform %>
</TR>
<TR> </TD>
<TD>
<%= objBC.majorver %>
</TR> </TD>
<TD>
<TR>
<TD> <%= objBC.minorver %>
</TR>
<TR> </TD>
<TD>
<B> Does the Web browser support frames?
</TD>
<TD>
25
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
</TD>
<TD>
<%If objBC.frames Then %> True
<%Else %>
</TR> False
<TR> <%End If %>
</TD>
</TD>
<TD> <%If objBC.tables Then %> True
<%Else %>
False
</TR> <%End If %>
<TR>
</TD>
<TD>
<B> Does the Web browser support background sounds?
</TD>
<TD>
<%If objBC.backgroundsounds Then %> True
<%Else %>
False
<%End If %>
</TD>
</TR>
<TR>
<TD> <B> Does the Web browser support JavaScript?
</TD>
<TD> <% If objBC.javascript Then %> True
<%Else %>
False
<%End If %>
</TD>
</TR>
<TR>
<TD>
</TR> </TD>
<TD>
26
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
OUTPUT
27
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 15
ADOVBS.inc File
ADOVBS.inc is a file included with IIS that holds all ADO constants
defined. Most ASP scripts use constants with names like
'adOpenForwardOnly' and 'adLockReadOnly' when connecting to databases.
These are constants, which are defined in the ADOVBS.inc file and
define various connection and recordset properties with English-like
names.
To include ADOVBS.inc, add one line to the top of your ASP pages:
which reads
<!--#include virtual="/adovbs.inc"-->
28
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
29
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
30
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
31
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
32
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
%>
33
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 16
For Windows 7 user, first open Control Panel then select System and
Security option in which select Administrative Tools options. Double
click on ODBC Data Source Administrator icon.
Now you will see ODBC Data Source Administrator window (as shown
below). Select System DSN tab, and click Add.
Click Add button and then select the Microsoft Access Driver and click
finish
34
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
After creating the System DSN use that connection for a particular ASP
page. The following script shows System DSN named myDSN:
<%
Set con = Server.CreateObject (“ADODB.Connection”) Con.Open “DSN =
myDSN”
%>
35
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 17
<Html>
<head>
<TITLE>Information Tech Dept</TITLE>
<LINK REL="STYLESHEET" HREF="table.css">
</head>
<Body>
<%
Dim conn, objRS, Sql
Set conn = server.createobject("ADODB.connection") conn.Mode = 1 '
read only
conn.connectionString = "DSN=dsnemp" conn.open
Set objRS = server.createobject("ADODB.recordset") Sql = "select *
from emp"
objRS.open Sql, conn
%>
<center>
<b>Information Technology Department</b>
<TABLE border=1>
<TR>
<TD><b>Employee Number</b></TD>
<TD><b>Employee Name</b></TD>
<TD><b>Basic Salary</b></TD>
</TR> <TD><b>Joining Date</b></TD>
<% do while not objRS.EOF %>
<%= "<TR><TD>" & objRS ("Emp_No") %> </TD>
<%= "<TD>" & objRS ("Emp_Name") %> </TD>
<%= "<TD>" & objRS ("Basic_Sal") %> </TD>
<%= "<TD>" & objRS ("Date_Join") %> </TD></TR>
<%
objRS.movenext Loop objRS.close conn.close
%>
</body>
</html>
36
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
OUTPUT
37
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 18
stu_insert.asp
<html>
<body>
<h2>Student Insert Record</h2>
<form method="Post" action="rec_insert.asp">
<table>
<tr>
<td>Enrollment No</td>
<td><input type="text" name="enrl" size="20"></td>
</tr>
<tr>
<td>Student Name</td>
<td><input type="text" name="sname" size="20"></td>
</tr>
<tr>
<td>Contact No</td>
<td><input type="text" size="20" name="cno"></td>
</tr>
<tr>
<td>Semester</td>
<td><input type="text" size="20" name="sem"></td>
</tr>
</table>
<input type="submit" name="Submit" value="Submit">
</body>
</html>
OUTPUT
38
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
rec_insert.asp
<%
Dim conn, objRS, Sql
Set conn = server.createobject("ADODB.connection") conn.Mode = 3
conn.connectionString = "DSN=student" conn.open
Set objRS = Server.CreateObject("ADODB.Recordset") objRS.open
"Student",conn,,3,adCmdTable
objRS.AddNew
objRS("Enrollment_No") = Request("enrl") objRS("Student_Name") =
Request("sname") objRS("Contact_No") = Request("cno")
objRS("Semester") = Request("sem") objRS.Update
<%
%>
<p>
response.write "record inserted"
%>
</p>
<% objRS.Close
Set objRS = Nothing conn.Close
Set CONN = Nothing
%>
39
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 19
<%
Dim cn Dim rs Dim sql
rs.Fields("Student_Name") = nm rs.Update
response.write "Record Updated" rs.Close
Set rs = Nothing cn.Close
Set cn = Nothing
%>
40
DDE BCA 3rd year lab: Web Designing Reference Number:19233015
PRACTICAL 20
<%
Dim cn Dim rs Dim sql
41