0% found this document useful (0 votes)
8 views

IT Practical

The document is a practical record for students at Harikisan Maloo International School, detailing various web development tasks and projects to be completed during the academic year. It includes instructions for creating websites, web applications using ASP.NET, and implementing features such as hyperlinks, image mapping, and multimedia elements. Each practical task is accompanied by specific aims and example program codes for students to follow.

Uploaded by

parv service
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

IT Practical

The document is a practical record for students at Harikisan Maloo International School, detailing various web development tasks and projects to be completed during the academic year. It includes instructions for creating websites, web applications using ASP.NET, and implementing features such as hyperlinks, image mapping, and multimedia elements. Each practical task is accompanied by specific aims and example program codes for students to follow.

Uploaded by

parv service
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

Harikisan Maloo

International School, Amravati.

CERTIFICATE

Name of the Subject_____________________________________________

This is to certify that this Practical Record contains the Bonafide

Practical Work of Mr./Miss_________________________________________

______________________________________________________________

During the Academic Year ________________

Date :

Sign of the Teacher


INDEX

Sr. NO Name of Practical Remark


L Create a website of 3 pages in which each web page is intertint<ea,
select appropriate theme like(Hotel profile, company profile, etc).
2 Create a website using frame with given layout select
appropriate theme like(college,profile, company profile and

3 Create a web page which gives Hyperlink on a web page using


Client side image Mapping.
4 create a web page using Hyperlink on a web page using server
side image Mapping. create a web page with an inserted image
having jpeg or gif extension
5 Create a webpage
for specific number of times without controls. This page must
also contain an animated file where display dimension are
100x 100 pixels.
6 create a webpage that plays a video infinite number of times
with controls. The displayed video should have dimensions2oO *
150 pixels.
7 create a web page using HTML code that contains at least four
major differences related to marquee attributes, Light and Dark
border colors of Tables, Display of Broken lmales with its
attributes, Display of Blin! text and Background sound.
B creation of webpage in DEvnagri script(Marathi or Hindi) using
Unicode .Select a proper theme like "lndia',, ',population,' and
write five lines information. Use MS-word with Baraha IME or
Arial unicode or Mangal font and save as HTML.
9 Create ASP.N ET web application using Visual Basic .Net to
display a report of client lP address, browser etc.
10 Create ASP.t!ET web application using Visual Basic .Net to
display server side tirne Limong with client side script to display
client side time.
11 Create ASP.NET web application using Visual Basic .Net to
calculate number of days a person has lived on basis of the date
of birth.
1,2 create ASP.N ET web application using Visual Basic .Net to
display contents from a text file,
13 (a) c'eate ASP.NET web application using Visual Basic .Net to
display hit counter.
(b) Create ASP.NET web application using Visual Basic .Net to
d itp]gy rq@gtqlvotes cast.
Practical No.1
Aim: Create a website of 3 pages in which each web page is interlinked. Select
appropriate theme like(Hotel Profile, Company Profile, etc). and create pages as
follows.

1) first page of a website has a backgraund image related to the thema.

o An introduction to the theme has highest level heading and 4 physicaltags


o lt has a hyperlink.
2)The second page has

o An order list with 5 items with discription.


r A link to an e-mail address
o The second page should be connected to the first page through an image icon(image hyperlink)
and to third page through text link.

A form generated with controls like text, radio button, textarea and submit button.

. Program code:

<html>

<head>

<title>

Harikisan Maloo lnstitute of Management & Technology</title>

</head>

<body background= " file: / / / D: / exptl/imges/image2.j pg" li nk=" red">

<hL align="center">Harikisan Maloo lnstitute of Management & Technology</h1>

<h3> various Department in college</h3>

<strong> l.T Depa rtment</strong><br><br>

<b> Physics Department </b><bi"><br>

<i> chemistry Department </i>

<a href="file : I/ID : I expt1,/second. html ">Second Page</a> <br><br>

. <a href="file:lllD:lexptl,/third.html">Third Page</a><br><br>

</body>

' </html>
rylwsse?s47

<html>
<head>
<title>
Harikisan Maloo lnstitute of Management & Technology</title>
</head>
<body bgcolor="aqua">
<h1 align="center"> subject in 12th lT</h1>
<ol type="A">
<li> c</li>
<li> Operating system</li>
<li> HTML</li>
<li> C++</li>
</ol>
<a h ref="f iI e :/ // D : I expt1,/i mges/i ma ge3.j pg" width=" 150"/>
<a h ref="f iI e :/ II D: / exptt/th i rd. ht m l" >Thi rd Page </a> <br><b r>
</body>
</html>

. <html>
<head>
<title>
Harikisan Maloo lnstitute of Management & Technology</title>
</hea d>
<body bgcolor="green">
<h1- align ="center> Student Registration form</h1>
<form name="f1''>
Enter Name<input type="text" name="t1"/><br><br>
Enter Password<input type="password" name="t2"><br><br>
Enier Add ress<texta rea name="t3" rows-" 10"></texta rea><bp<br>
select Gendercinput type="radio" name="11">Male<br><br>
<input type=" radio" name="12">Female<br><br>
<input type="submit" name="b1" value ="Submit">
<input type="reset" name="b2">
<fform>
<a h ref="f iI e :I I I D : / expt1,1se co nd. htm l " >secon d pa ge</a ><b r>< br>
</body>
</html>
$s@t

Output:
${&,rbb.h,n*r,, -;{{*;riiW.;:iitiii&#{.ffirHiirii,ii;!;ti:i*tifr#ii*,.,.. * --.o,-:,}^ ,::. .,"
.:: i.#.*
$r**x**
Practical No.2
Aim: create a website using frame with given layout select
appropriate theme like(college, profite, company profite and
environment etc.) and create page as follows.
o The web page is divided into 3 different frame left, right and bottom.
o The left and right session have hyperlink each hyperlink on clicking display data in
bottom frame of the web page . The bottom most session changes the content
dynamically. Create internal CSS for hyperlink files with three properties.

Program Code:

Cssl.html

<html>

<head>

<title> Harikishan maloo international school

</title>

<style>

h1{font fa m ily: Monotype corsiva; borde r-style :dashed;border-color:red}

b{font-size:35pt;font-style: ita lic}

bodyibackgra u nd-color: pi nk)

</style>

</head>

<body>

<h1 align="center">lnformation Technology</h1->

<b>Web Designing</b>

</body>

</html>
ry+Fry

Css2.html

<html>

<head>

<title>

lnformation TechnologY</title>

<style>

h1{font-family:comic Sans MS;border-style:double;border-color:green;border-width:15pt}

strong{text-tra n sform:u ppe rcase}

bocJy{backgrau nd-color:aqua}

em{word sPacing:25Pt}

i {text-decoration : ove rli ne }


</style>

</head>

<body>

<h1- align="center">harikishan maloo international school</h1>

<srong>lT lab</strong><br><br>

<e m>gymkghana</em><br><br>

</body>

</html>

Linkl.html

<html>

<body>

<center>

<a ref=" Desktop\css1. html" ta rget="f3">HyperLi nk1</a>

</ce nte r>

</body>

</html>
Link2.htmt
<html>
<body>
<center>
<a ref=" Desktop\css1. html" ta rget=',f3,'>HyperLink2</a>
</center>
</body>
</html>

Frame.html
<html>
<frameset rows"*,*,,)
<frameset cols"*,*")
<fra me src="C:\Users\exam\Desktop\link1.
html,, na me=,,f1,,>
<fra me src="C:\Users\exam\Desktop\link2.
html,, name=,,f2,,>
</frameset>
<frame src="" name="f3,'>
</frameset>
</html>

Output:
., ;:;;;";;";;;\iii]-::.i,iTH:Ns, _: ::d,Aid*ti&
ik, r,'d2ut .Lra hrnt..b..hr6r
f g
=
fnformotion Techno

Web Designing

trglihlshon moloo internotionol schooi

Hrplirk I
H)?aLi,k:
Practical No. 3
Aim: Create a web page which gives Hyperlink on a web page using Client side
image Mapping.

Program Code:

<html>

<head>

<title>

client side image mapping</title>

</head>

<body>

<h1 align="center">client side image mapping</h1>

<img src="C:\Users\Public\Pictures\Sample Pictures\Desert.jpg"usemdp="flower" width="400">

I <img src=" Desktop\Tuli ps.j peg" usema p="flower" width="400">*/


*

<area shape="rect" coords="43,'J,6,1-l7,52" href="http://www.google.com"alt="google">

<area shape="rect" coords=''43,1,6,7J7,52" href="http://www.google.com"alt="gmail">

<area shape="rect" coords=''202,175,139,236,250,297,206,220,720,289,192"


href=" http://c:\users\exa m\Desktop\a b:2. html" alt="color">

</map>

</body>

</html>
Output:

'H:l::'YY::t' ;--rnz,l Esrr


,ile - Frinl - ? i Open - St ,

jf;clizotsideimageaapping,/ficlientzideimagemapping &.lie*t.idetndgema1ping I?ctr€ntrdErm.gemappiog'$i(lientsr.Jein.g,

client side image mapping


Practical No. 4
Aim: Create a web page using Hyperlink on a web page using server side image
Mapping. Create a web page with an inserted image having jpeg or gif
extension.

Program Code:

<html>
<head>
<title>
server side image mapping</title>
</head>
<body>
<h 1- align="cente r">server side i mage ma pping</h 1>
<a h ref=" http://serverna me/html/expt3/i nfo. ma p">
<img src="C:\Users\Public\Pictures\SamplePictures\Desert.jpg"usemdp="flower" width="400">
' <img src="Desktop\Tulips.jpeg"usemap="flower" width="400">
<la>
- </body>
</html>
€ffFr?--:iGq,

Output:

Serrrer side image mapping


Practical No. 5
Aim: Create a webpage that continuosly plays a background sound for specific
number of times without controls. This page must also contain an animated file
where display diamention are 100x100 pixels.

Progream Code:

Withcontrols. html

<html>
<head>
<title> Audio & Animation with controls</title>
</head>
<body>
<h1 align="center">Audio & Animation with controls</h1>
<e m bed sr c=" file: / / / D :/expt5/i mages/k. m p3" loop=" 5",
. <h3> Animation image</h3>
<img src="file://lD:lexplS/images/im11.gif" width="L00" height="L00" alt="Digital">
. </body>
</html>

Withoutcontrols.html

<html>
<head>
<title> Audio & Animation without controls</title>
</head>
<body>
<h1 align="center">Audio & Animation without controls</h1>
<bgso un d sr c=" file:/ / I D:/exptS/ima ges/k. m p3" loop=" 5",
<img src="file,/llD:/explS/images/img3.gif" width="100" height="1-00" alt="bird">
</body>
</html>
Output:
*/;i;;;;;;";"*;;";;;- ",-ffi[}9[ffitr$1ffi&{ffiffi#. Wiii**:ll iriLt[&,,*iffi$.&i[i$iEipi;ffi*
---"*"*^' irtitr:,WW
.,,.
'urb *-J-* o o ="
ll,udio & l{,nitmation t.ith cerntr-ols
A&lt[alloE ail*ge

q,ria* rei$sirn .rii&.4d .8.-, *

{r6 ,$ *ry9
Practical No. 6
Aim: a webpage that plays a video infinite number of timeswith controls.The
Create
displayed video should have dimensions2O0 * 150 pixels. The video must playing on user's
interaction . Create another web page that plays a video without controls for some specific
number of times. The dimension of video file should be 150*200 pixels.The video should play
when the mouse is placed over the video area.

Program Code:

Videowithcontrol. htm I

<html>
<head>
<title> video with controls</title>
</head>
<body>
<h1 align="center"> video with controls</h1>
<e m bed sr c=" file / / /
: D :/expt6/vi d eo/k.wmv" loop=" - 1" wi dt h=" 200" hei ght=" 1- 50" >
</body>
</html>

Videowithoutcontrol. html

<html>
<head>
<title> video without controls</title>
</head>
<body>
<h1 align="center"> video without controls</h1>
<img dynsrc ="file:l llD:lexpt6/videc/k1.avi" loop="4" width="200" height="1-50" Start="mouseover"/>
</body>
</html>
Output:
,9 dx ! * a &

ffi
\ idtr, $ itlr rantrrls

b;Wah :i, " ;:i;r r,.* x li?7,1/i,i/til

Irfi * * s
=
yidco rvithout contrrls

l:l:u.
Practical No.7
Aim: ceate a web page using HTML code that contains at least four major
.
differences related to marquee attributes, Light and Dark border cotors
of
Tables, Display of Broken lmages with its attributes, Disptay of Blink text
and
Backgraund sound.

Program Code:

<html>
<head>
<title>Cross border testing</title>
</head>
<body bgcolor="aqua">
<h1 align="center">lnformation Technology</h1>
<m a rq u ee d i re cti o n = " rig ht,' >S u bj ects</m a rq uee>
<hr color="red">
<blink> blink</blink>
<hr color="red">
' <bgsound src="">
<table border=,,6,, bordercolo16lg;.ft=,'gl.ggll,,bordercolorlight=,,yellow,,cellpadding=,,2g,,,
<t r>

<th>
chapter no.</th>
<th>marks</th>
<ltr>
<tr>
<td>1</td>
<td> web publication</td>
<td>30</td>
<ltr>
<tr> '
<td>2</td>
<td>crTber lows<r/td>
<td>09</td>
<ltr>
<tr>
<td>3</td>
<td>e commerce</td> -
<td>10</td>
<ltr>
<tr>
. <td>4</td>
<td>networking</td>
<td>12</td>
<ltr>
<tr>
<td>5</td>
<td>data base</td>
<td>1,9</td>
</tr><tr>
<td>6</td>
<td>tally</td>
<td>22</td>
<llr>
</table>
</body>
</html>
Output:

(r0::oei.,re:,,e -T,i'T'ffi*Iflfl .,;iTl{f:: '_I._,-


.
'rret,(.,*)Jai:r.tnrt trnrnt
" ,_ W@
*EfiV=

i ,subieir ' -,..4. , i


blink
Practical No. 8
Aim: Creation of webpage in DEvnagri Script(Marathi or Hindi) using
unicode.SElect a proper theme like "tndia","Population" and write five lines
information. Use MS-Word with Baraha IME or Aria! unicode or Mangal font and
save as HTML.

Program Code:

<html>
<head>
<title>>POprrlation in lndia</title>
</head>
<body>
<h1 align="center">Population in lndia</h1>
<h1- align="center">Population in lndia</h1>
<ce nte r>
<h2>
U-(9-u1q7 1..l 2, </c en te r>

q-+nT 3{rf, 6l gA* 6t ua riefi:{ sffqT t t w-gfr:it-r q-qt-qpT fr nmt fi frr T6 sil-tr ftiar 6r Fasq '
d;I rl-ql t t gE-fir qt-d rt ara-q-s{Er{I fi a-€i, str{a ilq-T-{-dT'q 3rT ;rrr t uq-h $qsrT-{ qrii 3fi-{
r

M. G H ltr{sq 6l arkm'3{Qt t riauft r 16 rrcrfr Gf 6-nrt qRi 3ir{ Si{ rT-5 t 3ilr ffir frlqd
e

fi q"m h eafr FznS H rS u-qy"T 6-il aiirr t r u-ryq +) frI dk w fi-f, *mr C fuerm l+-qr ar
q-+?r t-aTg n(qrr, Tf, q={sur rlk taB u-qrur I q a;fi €r u-fiR fi u-qyu ar+q *'FqrFz?T h fr1,
FIG-+TIzF R.qd G Hr
Output:
::\ ) 11,.: :' :\. . /

Population in India
Populrrtion in Inclia
?q5q * fis fJ ro o*iti v,.iq I I q6ia -}ii crtw . tFrl + ftr 16 qt fu,{ { fu-ry F ffi t
& r

iriir-,lzeffi-r'{FdiaF iq5nij.?-src:e n mf rYsfiAw+,rt ftha*iGt r


?Yru7iW

Practical No.09
Aim: Create ASP.NET web application using Visual Basic .Net to disptay a report
of client !P address, browser etc.

Program Code:

Public Class ...llaiauLL


Inherits System. Web. UL page

Protected Sub page_Load(ByVa1 sender As Object, ByVal e As System. r:ventt\rgs) Handles


Me. Load

End Sub

Protected sub Buttonl_c]ick(Byva1 sender As object, ByVar e As tventhngs)


Handles
Buttonl. Click
LabelL.Text = Request . Servervariables ( " nemote_host,, )
Labe116.Text = Request . ServerVariables (,,ser ven_por-t',
)
Labe1i.8. Text = Request . Se rvenVa riables ( ', s e rver*softwa re,')
Labe120.Text = Request . ServenVaniables (,' http_user_agent',
)
Labe122. Text = Request . Se rvenVa ria bles ( ,'s e nve n_name,,
)

Label24.Text = Request . ServerVariables (', senver_protocol"


)
Labe126. Text = Request . SenverVariables (,'path_i-nfo"
)
End 5ub
End Class
Design View:

r'& rtt vpr P,oi.( S",lr D.b!o ldm

Output:
,'(i-'{/z/2/.7,/z/l)

WW.31:i:Z
Practical No.10
Aim: Create ASP.NET web application using Visual Basic .Net to display server
side time among with client side script to display client side time.

Program Code:

Public Cfass _D*f;ru1t


Inherits System. Web,UL ? etg,e

Pnotected Sub Page_Load(ByVal sender As Object, ByVal e As System.Event,Args) Handles


l'4e. Load
Response.Write("<h1> Server side date and tj.me is</h1>")
Response.t^Jrite("<br>Serven side date is: " & Date.Now.Date)
Response.trlrite("<br>Server side Time is:" & Now)
Response.Write("<br>Server side Month is : " & MonthName(Now.Month) )
Response.Write("<br>Senver side l{eekDayName is:"
& WeekdayName(Now.Dayoft^leek))
Response.Write("<h1>Client date and time is</h1>")
Response.Write("<br>Client date and tinre is;<Script> Var d.; d=new
Date( ) ;docurnent.wnite(d) ; </script>" )
End Sub

End Class

Output:
Practical No.11
Aim: Create ASP.NET web application using Visua! Basic .Net to calculate
number of days a person has lived on basis of the date of birth.

Program Code:

Public Class lcrr*L

Private Sub Buttonl_C1ick(ByVaI sender As System.Object, ByVal e As System.ErrentArgs)


Handles ButtonL. Click
Dim datel As Date
TextBox1. Text = TextBoxl. Text ( )

TextBox2.Text = Date.Now.Date
datel = Convert.ToDateTime(TextBoxl.Text)
TextBox3.Text = DateDiff(Dat':Irrterval.Day, date1, Now.Date)
End Sub
End Class

Output:
ffiif Form!.

Date of Birth is

I oday date ls
Lr lltLVll

PERSON LIUED DAYS ARE

Enter birth dete 1].,rF.i 1 qq.q


Practical No. L2
Aim: Create ASP.NET web application using Visual Basic .Net to display contents
from a text file.

Program Code:
Imponts System.I0
Public Class *e.tt',ztui1.

Inherits System. t^Jeb. UI . pur6;c

Pnotected Sub page_Load(Byval senden As Object, ByVal e


Me. Load
As System. Event t.rgs) Handles

End Sub

Protected Sub ButtonJ._C1ick(ByVaI sender As Object, ByVal e As fvent/trrgs)


Handles
Buttonl. Click
Using sn As New Str.t:ayt?,eader(,'D:\one.txt,')
Dinr f As String
f = sr.ReadToEndo
TextBoxl.Text = f
sr . Close o
End Using
End Sub
End Class
Design View:
Output:

,i :i tr,..tf*1.31i1.r.. x

r u .,

I... {),,t,tr.r t<)t11itit tti 1t'1r t\

Y(FrQ, tAriar-D<v88,
T:l/H,G7iriU!:r,g 5.
i, ri'"
Inn'
5r,t ati 1'*i ilttll, a; ',1' .1. !tr"nR"d4 i'oi / Dt.i,r
Practical No. L3(a)
Aim: Create ASP.NET web apptication using Visuat Basic .Net to disptay hit
counter.

Program Code:

Public Class _Default


lnherits System.Web.U t.page

Protected Sub Page-Load(ByVal sender As object, ByVal e As System.EventArgs) Handles


Me.Load
Session("cout1t") = 5g55ion("count") + 1
Label3.Text = Session("count")
End Sub
End Class

Output:

l
l
l
I

L_...,*,,.==... . .
Practical No.13(b)
Aim: Create ASP.NET web application using Visual Basic .Net to display number
of votes cast.

Program Code:

Public Class -Ct*.tau1.t


Inhenits System.Web.UI. page
Protected Sub Page-Load(ByVaI senden As Object, ByVal e As System. f.vtr,fi.rg{) Handles
Me. Load
End Sub
Pnotected Sub RadioButton2_CheckedChanged(ByVa1 senden As object, ByVal e As
t:.r t:i) i. /:. t ii.5) Hand 1e s RadioButton2 .C hec kedChanged
End Sub
Pnotected Sub Buttonl-C1ick(ByVa1 sender As Object, ByVal e As Evenl1rgs) Handles
Buttonl. Click
If RadioButtonl.Checked = Tr ue Then
Session("yes") = Session("yes") +1
ElSe
Session("no") = Session("no") + 1,

End If
Labe]1.Text = Session("yes")
End Sub
End Class

Output:

subnrit I
Practical No.15
Aim : Creation of data base a nd ASP. N ET code that allows a user to view releva nt information from the
same.

Creation of MSDatabase:-

1,. Click on start -> Programs -> Microsoft Office -> MS ACCESS 2007.
2. Click on Office button -> New -> Blank Database -> specify location were to save file -> Create.
3. Right click on table -> click on design view -> give table name.
4. Add following fields in it.

Field Name Data type

Empno Number

Empname Text

Address Text

Contactno Text

Salary Number

5. Save table by pressing Ctrl+W and add 5 records in it.

Connecting MSDatabase:

L. Click on website -> Add new item, given the program name.
2. ln solution Explorer window -> App_data -> Add Existing ltem -> select employee database.
3. From toolbox -> Data Controls -> AccessData Source.
4, ln AccessData Source-> configure Datasource -> Browse -> select Employee Database -> Next ->
Next Finish.
5, From toolbox -> Data controls -> GridView
6, Right click on GridView-> properties-> DatasourcelD -> select AccessDataSourcel.
7. Press f5 to run program.
Practical No.16
Aim: Use of database and ASP.NET code that allows a user to view as well as
edit information

Program Code:
Imports System. Data.OleDb
Imports System.Data
Public Class 0e fault

Inherits System.Web.UI. page


D1m cn As New OleDbConnection
Dim cm As New O.leDhCommand
Dim da As New OleDbDataAdapt*r
Dim ds As New flatd,e.L

Protected Sub page_Load(ByVa1 senden As Object, ByVal e As System.EventAngs) Handles


Me. Load
cn.ConnectionString = "provider=Microsoft.ACE.OLEDB. 12.0; Data
source= | oataoictionary | /emp. mdb,'
cm.Connection = cn
If IsPostBack = False Then
fillgnid ()
End If
End Sub
Private Sub fillgrido
da = New OleDbData.i-ldapter(,,seIect * f rom ernp',, cn)
da. riJ.1(ds)
GridViewl.DataSource = ds

GridViewl . DataBind o
End Sub

Pnotected Sub Buttonl Click(ByVa1 sender As Object, ByVal e As IventArgs) Handles


Button 1 . C1 ic k
cm.CommandText = update emp set salary=" & txtsal.Text & " where empno=" &
txtempno. Text
cn.Open( )
cm. ExecuteNonQuery( )
cn . Close o
fillgrid ()
End Sub

Private Sub Data(ByVal p1 As Object)


Th row New l';ct Ifl p 1 enl{t rrlEt rJf. y.t,tp1. ia n
End Sub

Pnotected Sub TextBox2_TextChanged(ByVaI senden As Object, ByVal e As [ventArgs)


Handles txtempno. TextChanged
r.€#€lBffiiFqEg'r

End 5ub
End Class

Output:
ryrer€r:ry

{
docu ment.bgcolor=" blue";
wi ndow.setTimeout("f10",t2OO);
function msg0
{
window.status="display of 7 distinct colors";
)
</script>
<body>
<body bgcolor="aqua">
<center>
<input type="button" name="b1" value="colors on MouseOver="f10"><p>
<input type="button" name="b2" val ue="message" onClick="msg0"></body></html>
Output:
, ii) filet,r,r.iC;,rUEerslqam.lDesktopl'l7,himt

,::, _..,=.. _.,rl;,;;,r;;1r,, :1,i,,..,,$.i:1i,1.. ,,,


. c.0lors onMouse0ver=
- l'.
1,, 'l: t ',,,,,r..",i:.i;-t t'
;,,;l:', '
Practical No18
Aim: Use a javascript for validation of Pin Code and Amount.

Program Code:

<html>
<head>
<title>
Validation of pincode and salary </title>
<scri pt la nguage="Javascript">
function pinsal0
t
var a,b,alen,x,y,dp;
a=f1.t1.va lue;
b=f1.t2.value;
alen=a.length;
x=0;y=0;
if(alen<6 | lalen>10)
{
alert("pincode min 6 max 10 digits");
f1.tl-.va lue=" ";
f1.t1".focus0;
x++;

if(isNaN(a))
{
alert("pincode only digit");
f1.tl-.value=" ";
f1.t1.focus0;
X++;

)
if(isNaN(b) | lb<0)
i
alert("salary ivalid value please reenter");
f 1.tl-.va lu e =" ";
f1.t1.focus0;
y++;

)
=Fsaire?..jry

dp=b.indexOf(". ");
if(d p>-0 && d p<b.lensth-3
{
alert("salary ivalid vaIue please reenter");
f1.t1.va lue=" ";
f1.t1.focus0;
y++;
)
if(x<1 && y<1)
{
alert(" both accepta ble");
)

)
</scri pt>
</h ea d>
<body bgcolor="aqua" text=" red">
<hr> enter pincode and salary<br>
<form name="f1">
Enter pincode: <input type="text" name="t1"><br>
Enter salary: <input type="text" name="t2"><br>
<i nput type=" button" value="validate" onClick="pinsal0">
<fform>
</body>
</html>
Output:
onadiaiiu i
",
?a.-.:ffi
}\-% l8__ F1p16,ffi

;,'F.rct!! ti* f ,i/,,r.-r..i:ir1t-

* hdd6 d pin.cd. rd lrrr.i


Practical No.19
Aim: Use of Javascript for Validation of Username and Password.

Program Code:

<html>
<head>
<title>Validation of username and password</title>
</head>
<script language="javascri pt">
functron user0
t
',/a r a,b,alen,blen,x,y,p,ch;
a=f 1.t1.va lue;
b=f1.t2.value;
a len=a.length;
ble n= b.le ngt h;
x=o;y=o;
if(alen<61 lalen>10)
t
alert("username not acceptable:min 6 max 10 chars");
x++;
)
if(blen<6 | | blen>12)
{
alert("password not accepable: min 6 max 12 chars");
y++;

)
if(b.indexOf(" ")>=0)
{
alert("password:no blank space");
Y++;

)
for(P=g'Pqr 1e n; P++)

{
ch=a. ch a rAt( a );
if((ch<"a" | | CH>""2)&&(ch<"A" | | ch>"2")&&(ch<O | |ch>"9")
{
alert("username not acceptable: only alphabates and digits");
x++;
' P=alen;
)
i)

if(x>0&&y>0)
alert("both valid");
if(p0)
alert(" password i nvalid");
if(x>0)
alert("username invalid");
if(x==0&&Y==Q)
alert(" both invalid");
)
</scri pt>
<body bgcolor="aq ua" text=" red">
<hr>enter username & passwordcbr>
<form name="f1''>
username:<input type="text" name="t1"><br>
password:<input type="password" name="t2"><br>
' <inputtype="button" value="validation" onClick="user0">
" </form>
</body>
</html>
Output:

, r:t: ii--"::
useryiatlle:
pass\i'01'tr
l .,..
i ,

ivalloatl0n
i-"*-,-**1 ,:: rl-
i
'': -::$l:
i
t:::' ,:: . ::::, : irl ai: ! - r':t i:: .:.
:
I

,l
;
(..i
. d iI
ttt l
..
a
Output:

i1__ Fj\NA' {!ldd4i'j.f tel

,, F 1odr.' ...,a X l..:,),,..1.t'.t... ? \,:.;t<.\;.1J.\,

: Zi - - ..:. 1i, - rree, sdei/, rel,, {i, .,


€:l

Dt*-l'alidz*.i^

l;'
: iiria"at-'':.::., :, :t:,r::.::. i
l. ,-) rt-, "t::. ::
! 1r
! .. I :t il

t.
i.. ,
: ...-
.' ,..,.
. ...
t: i ".-r.

I.-, .: .r -:...

'',: E
l
i
;' | :l': \i:. r::.::,' lt:'j?; a.::,.'' ::u':,:
i
!

a
Practical No.20(bl
!f

,
Aim: Use of Javascript for Validation of E-mail Adress.

Program Code:

<html>
<head>
<title>
validation of email address</title>
<script language "Javascript">
function email0
i
var x = foi'm1.em.value;
var atpos = x.indexOf("@");
var lastat = x.lastlnciexOf("@");
var firstdot = x.indexOf(".");
var dotpos = x.jlastlndexOf(.);
a
if(atpos< | | dotpos<atpos+2>=x.length | | firstdot<atpos | | atposclastat)
{
' alert("not a valid e-mail address")
forml.em.focus;
)
else
{
alert("Email address is accsepted");
return true;
)

)
</script>
</head>
<body bgcolor="aqua" text=" red">
<form name= "forml"onSubmit=email0 method="post">
Validation:<input type= "text" name="em">
<input type= "submit" value= "validation">
</form>
</body>
</html>
a
+effir€

Output:
r
a

iZ tuoe6 " .i:t t. t4r,.!*a'a,r..' - al, iti JtF !.lki'

7:r1:?.t:4.::::!-:1"...,1:!:.i:y;,|:i;1ra::::1ir;,wi.==::/::":-t--1.t:.:.--..17:a::1t111ri--=::-::::T:----.
, - -,tj"l ": I jj'
;" ..-i;
:. ' f' .
::: .'.\: "':
av
":, - ,r
. ': :
-".l}-il
-,1-. ---l:-
:
-, a
,i :: :t
';:{:
:t'vi
';:{:
::: :: ::t :::::

'::.:t.a:t::':: l. i :::, :l: .;'...:::aa:l:ti: . .. :':q:at:!.1.:;

::: i:::t :: t' r..r" :;..,

il ComF!,lPd.de M.di g,t

You might also like