* semphg Languages 2~
These axe Spadalizad programming languages isch
ore used emhante -Jantkionolily and eppeartane ob vinbprget
Twese are toe pet
~ Cliewk -side seaping lavage used e Simp volidetons
ab client - side.
= Sevyay - sya Sevipliug larguege used 421 dake vabtdalien
Sexi pg languages
clienk-Side. Server-Side
| /| No ’
| fe Tae
Poe
vBsoiet Jscsipt govaseript == ASP
aap Seely
>
leg:
Ths is Used 6 eludes Me Sevipt info hhnl
document.
Amok:
scrip language. = noe ok Sedpt >
2 The Senipting languoges cou usted [S Madlity dacument!s
Conlink dynamically.
D Fevacevipt Wa clieukogide Sevtoting language -
Scanned with CamScannera Tnledudon tp Tove soant
Ravaiceripl ig om okget— hostel Seviptivg logo
which is designed IS enkane uncktonalily ob vsckpogy
nak cre dovatopad lth HTML-
Tavasewpt is a clcewk ~ Side tv ping lavigusye.
> Simi leisies beluean Tevareriot ome TNE +
Ls oth haue Some kind ok opexaleys,
Ly Simiay coube| Shrucbares.
Ls concepts nh obgedks ond matheds ort Sinthar.
SD Dipherentes bekuama ganaseript avid Jove .~
Ly seve is am cbyatt -Buienkid when gavaseriet
| is an obgett-basad Sevipkvy longuayé +
L> oun seme code U compiled fvsk and IMAM
twlivpratid, lle Tavaseript Code is nak comeled
only iulipyeted -
Notis- ty rae obgect — based programming Langue, wt
com ude pre-defined objects only
The obgect —Sienld paguammiug language Suprety
ts cveolt naw objets ond te wt te Objet
> Benifits oe sovaseripl 2—
Ly Widely Supported tn tanh browsers
C5 ua’ Sips “Aaot Wane Spee Bg :
uy «your Sem pt-
Lo af giws Mme eaty aceots Je document obyett o
com most ob Them «
Scanned with CamScannerX Vesta bles t=
A voriable is a named locatd that usted.
to stove any value dal that parhealor progyom +
Rales 4A Naming Tht variable :-
begin uit a letter & aigit ® Uvde vier’.
—> Names Musk
> spaces ove not allowed in bebucen vaicable Mame:
> Names ave Case demsidive -
Ke ami +
> Reserved wed work wre as Vortable
ng one Kaysdd
=> AML Vediables Can be datoed by using ye
he “guy.
Efe Var ay
Nay sume 07
* Datatypes
jouaceript supports fellew(ng closteliypes
ot
Ls Numeric a
Ke °
Ls strings —" Vey ase’
oto
1 Boolean vow Num = 10! x
ee vo mani" 7
vey ages null; 4 wuld
operelies im gave senet t-
| Ls pvimmelic operalasi- — b> Reledional operalovst-
+ 5 Addition 4 2 less thon
| - = Substraction > > Grade Than
| % > Mullspli cation ez lassie a equel to
f= Division de ~ gras thay ayquel ©
fs Be aie Ly Logical epexelos
SY tpeuloe :- gy —> logical Awd
> 1s qual © Hy begical oR
> ty not eyual te
- Scanned with CamScanner© Programming iim Tava sexipts +
Examplti- The qeollesing enample preg rerr cisplogs ty
Nalmol ext «
hal
eHHe> Samp
exit
4i-- This ndicales he comment -->
%,
clouuments tovitilyy CTs ts my teste peegvom "2:
documents umitaln Co abaak gavecenet Ds.
Tewiplt shtml
gava seve
|
| < Ihbnl>
[Ose geen
| Th Te above encmple, .
S esenpt > tag is used to theluding Me Stvipt inl
This ig my ofrsh prgvom abrk yao sever
html doument.
Bates HM tite ta uae Fo disgloyy By candle rae Cone
Text +
D>“ deawents owt” is Ud Te disploy some [axle on mt
" EAD
Not A ged practicn te deploy my Sevieh tH Mae HEA
vagio se the HTML Code -
Scanned with CamScannerExample: the Jalluang script damonshats Ma adelition end
subsvadion ob hws numbert:
chim > AS ahtml
| sempt te addiien and Subbracian < Htle>
ESCAPE Language =" gavaseript" >
j vet My Ma, add, Sub!
Ns boy
nels;
add= Nem
Sub =M-ny
dowmeuts wovileln (Addition is" todd):
tourments vovitily Ccubbedion ie 4 Sub)
Z1Sej pt>
Alhaad>
Addition is 2
Th Te emampl, ox Can assign te voIMns alivodtly to veowables,
fwntioa tae Gin! CHa alee provide These volaits ynoemieally
| during suo time
tne Number 6 be
| TH do That, gust repack Tha Code tom
F by sellmsiny colle «
Scanned with CamScanner|
|
|
fy = parse Tak Cuvindas « promt CO ewliv my volar” 3):
vy = parece Ink (window - prompt C“eule Ny volus")):
uy, The cukput will be gewnatyd I -plluivg manney
no «
Sei
Addition
Subteadnn 1 20
In the ebowe enampl,
> Window «prompt — Tk coutes a small windms [6 be
displayed on comsale .
> pavseTnt — Tt is used Te Conuevh the given Shing
Taber +
Similoaly
=> porserloal — TL is und te convevt @ givon Shing
feeding volun
nde
a
Scanned with CamScanner¥ Conditioval Stelaments:—
Ls & stalemew :- Ls alee tt ladder:
Synte'- Gb Condition) Saul Lp Condition)
qj L
Statoments" Statements;
t
3 elte if Cconditiw
Ly Yeelse statmewk: t
— ~ Stalamenty 5
Syuloxs- if Ceondition) 3
5 aise
stam :
: aments: Ements:
else 4
t
staltmonks »
I
cy Taree Ni
Example yy
;
ELit> manimum o& ZB numbers
Ver Wy As Mey
ny, = powseTat Cwindms: prompl (“Entiy ny vole")!
ny = parseTak (winders: prompt (elev nivel) J)
Ng = porseTal(cuivdrs: proMPEL™ Entiw vig vole ))>
ub (n> nL ARM OMD
doumant cava L”moximam is ani),
$
else FCM FE WPN2)
daumtak, writly Umaximum is” +27
3
else
it
docament, wibily tt manctannnt HF PM 2
Scanned with CamScannerap
elseniet>
2 body >
< [body >
ethkml>
Scanned with CamScannerx Looping Stale monty —
Lo while stalaments—
aegin
|
| whik Ccondition)
| £
Staliments;
| 4
Ly do-whik stalement :—
sywlox-
do
{
“Staliwtends
F wii: (condehion
Ls 4a stotiwenk
syntax
48 Ciniticl vation; conditions inevoment/decrement)
L Resin
Stehwwenks 5 tn
a False
| i Edt
|
| Tut.
L
|
[Eaertmtel] peace
* Byanching Shliment -
L sutten Caseim — Sywlie- Sei tel ( Ru pression)
L
case 11 stolimenks > brat;
cose 27 Stolament; ereute;
defeuth Sabrent,
&
Scanned with CamScannerata Hud Joctatof a atven Number.
|
| cheod>
| | kille 7 portend
| |
Ff) net nigt feud ey
| | totink Lovndeue- prompt (" Eukiy a muwber'));
|
| |
|
|
N= pay.
eben eso)
i
L
-
dowmet. wll cYfectival ts 1
2 .
deur = Jak x0
f :
Sevaments edb ly ("actives i’ 4-4ory
| 3
2 Wevipl>
Zlhead>
2 body >
|
|
|
vo number dodaveh is 120
Scanned with CamScanner| % Functions
\ A function 1s a sel}- coudained block ob Slate wed
tak pertim a pettaday tase.
| Bosically,functoms ae tus types, They ore
> pradafined furdions
> Usev defined enchous
Ly pre defined aunctiong —
These ave alse called as global functions, becouse
They cam be callid and used ty any part ob a program.
> isFink Os
Kwually The about. fonction fates tha numeric
Value os am adygument and rebar true owby iF he quis
cogument results a ferrite numeric else if %eharns false
Exampll’-—jspinike (Sho)! 7» TE nelins false
> isnancye
© Te mien shut slates only Sb ta on gumente
is nk a number, cle i nelivas o false satcu.
Exampl’ sna (0); > Th rekions true,
> pouedaho
Te acept, Shing as argument and Comunts
| iW ify Sguivalant ~ nunete,
Example. panseTak (iow; 3 Tk converts (9 1@02
— porsaploatty:
Tr aaceapts String as omgumtule and comme dts
ke ih equivalyak locking yalus
i Bompl:- parce pleat (1); 3 neo
| > eal , ub, it is aed
|
Te lees ao Sting ay an oyume
Te ape evaliting The Shing .
Scanned with CamScannerFramplt~ Eyal (2.%8) —) Th melins &.
Ls user defined —fanetions to
_ hese Juwdens ame difivid by User by va
predated bryurdted “ancien”,
Cork th these fundions cam have JAaing
=> Junchon name
> Lise of poremelirs
> ust de Stalimonts
> Relarn ype
Sywax
funition Jundion — Nera C parawylirs)
14
Stalivarntss
Zhtml>
ZATL> Example far feurctions Z/te?
Zseripk language =‘ gavaser et” >
Vor a
a= parseTuk (usindeu prompt L" ext & num")
doumenks writin C’ spun xf gtuen he a”
sh sqeet co)
ouume wh sti | a it
e + wl s tvam ne
hg e es cubeta);
Junction gqusu CK)
Scanned with CamScannert
| ven 2
| Cz KKEK kK
roku ©)
4
Zisemel>
2 theod >
2lhtwl>
| function cube CK)
|
|
eS
bx Obgects in ova, sexipk t=
Uses check -dueubed - comlapts :
wohid obsec is noting
oq olley autres -
ouejos
Ta Tm oval
which | can, depart We
Ta, Tava sonek obseks
| deka and cundiont+
once, The gave sedge gehs
Space & su sevad fai “Gack obbgacks
axe. Stoved -
where. tks
dunckiont
The Jovaseripk Suprortt Doumenk obgeck t-
ae wid dowmert mesa te the
silt dtsqlasys Ma, broustey waindeas
| Tr had fellewivy methods
| > Wie / Writely (-
Tw Usd 5 display Me fExt on I
Bxample- a
dowsmerc. vont (“ yoi" I,
Ai tad
Scanned with CamScanner
Ty todays wsdtld clmask all pragramming Long vages
conteurt Vnleivg
enoulid, o Sparel moby
bulk an ently,
dota. ond
page which
chuemontsA &f usiudns. closeo +
al te process (Gr elements th frm,
Exempt! — douumantacdms (dam~- namely
> Unks O6~
a is used to
Llebpage «
Exon: clourmert. Enks 00>
hold He number ob Unes th
=> closetr:-
Te u used 6 step tuserenk proais on Me
dotument.
Exava — dourmouk. clese Cd 5
Ly Window hye 1 /
“Te Wag a Hele bar, message , defaull (eon, writ
one BL wae Command ufos
Te Supprrts felleuseuy mattinds
fe hod
PD OPN” TE is ated G open a new poindaa DF
4u30 Sgumonts | \Rese oe > URL i catetsd
=> Name wit
fd
iH
— Windaus ope (Tua , “namel)
F SEO Tie used te cecall” Te edtadeus easily -
Ue Mas shoo oyumens , thote tt > x- co&divall
y - Cobtdi nolh..
EX Windmas Serell (100, 185) +
D> promt ays ua be Seer loysl ithe ie
user by dispayty Seat voinden-
EX Windma. prompt ("emir a value"):
2D cote op te uted te Clnge me cuvent
de"
Scanned with CamSeanner| b> Math obyeck i ™
che math obgetl have Ta ditteak pes eb matkals.
those aut uted To penvdiim several MoThemedion) cablastalins. |
Te has qelmaing sydax,
Math « method (numeric velists) |
sre owing oe FHopuoubly used mathematical melReds .
3 mmo
Te acsplays Ma minimum dk two numeric values.
ex: doumenks UAE (Mathemin (19SI)2 Moje ©
D> maxd)e
TE displays the onium
ERY doumeut. ene c Mat: max (1orS)); MHeze- 10
tuo numbers
> abscuin-
Tr meting Me absolali vols th %
Ex dowment- wv (Marth. abs Cus); Heer 43
SD c&lOyi-
TE reblivns Me nesmesl- iwligey nok (esy (han x.
CE gouamenk « wile (Mame CHLOE); Mole &
dowment« candle Cate Cal (G0, HM ove 6
=> romd(n)i-
qe Tekurns ta veorest i
’ ER gowments writ (mata. rows (s-6)5 epee &
document. on & (maths yaund (6-09; Leyes
> Moov) s—
Ak satinens. wea nesstest ibeger nek greeter Than.
EX" douumant. writ (math floor (5-8) 5 Nope
doumerk. cont (Matfer CSD); I eres”
PEO TE sutusns pray ob one velit’ :
Evy doussnent. cite ( memm «pases Hop: &
~ Scanned with CamScanner|
PsgTtOr Tp veliwns Ta guert crook ok given Mumber.
| Ex: doument- citi (math seb la2 Me 3
sive, Value
> sinto'~ ge mobaens digenome dae
dowmeut. usw le ( Math aSinlQo))? I Me= I
Qusns digowemebic CoS value.
AL Cuath. Cos (oI) ueyo. |
tan volus -
a
> cos It mw
gx! document +2
| > lam yt Te selans tvigevomedte
bx douwment. voit CMath lam (usd), W%p 3
> bog! TE relivns leg odtionic equally vole
ERS dauument « coil, (Mah » log 62-91); Sie va
Ly sting obgeet t=
Ty geno Kew:
enclcod under debi. quelt.
The Minsing ave frequently used hing mottiads
| ms sting reader la Sones ok choxocbnt
> lp Lowey ase Ot
Te is used te Convevt TH givem shiny into lowe?
- cate letters.
Ex vay name > MADHU" :
douument. vsvitily (name - (6 Lower ose) 5
I ete’ mad bat.
D> bo Lppev lose (0 *-
te ig used te Convert It given sing fate epe™
-cose letters.
ER Vay names Vmod! 5
douments coviklly [name + boUpper GseO),
Nets MADHY
> Concak O*>
The simply
ER vay nami Mr
ovumontrs vow le [ ROME concatl"
combines A ConCalinsles toss Shings-
”
may mel
madi’); Ma"
Scanned with CamScanner@ chav ALO!- ya
Te relies a cludiadew based on given iudaje value -
Ex var names" Made” }
shame. CheAE (3): I eypim W
| > suleste'-
a is uted fe embark subshivg tom given shang.
Br uge Hoe ceegurne, “index” and “length’s
x= vay names" Mad he"; |
mame substel2/2)).. ff %otn dh
=> Subshingdi- 9%
qe is used f6 enlrark Substing rom given “ging >
Te use hoo arguments, "index" and “end
Ee vay nomes “ madha”y
name, Substring (2/42 Hog: dhu
=> index of 0) —
TE melon an asx abasad om
eer var name = * mad!»
name. index o C's!) I Oy >
=> lostindss of UW
De tars a chotatley as am argument and ruliimns
ca ok Lasers tH hinge
given chennliy +
Tm uate value, hte is appsenens
a ver name =" my madh! 5
vores Lasttndex of er’) > [ote 3.
> Length ,
Tt nalaems « length oe given Shing.
ex var names Madu! j
ramen (engi s fae 5ky mt obsel
| syst ok That ‘mshant
| & gilMon or dp vetirns © fo I
amis object simply caplions The dale oe tte focal
and. reliems the volus -
soa ay Cunvertbdali = Keto Bali Oo;
TH has delewing metheds
3 behing! Te sutiyns te sting respectiae oh dali,
> gtd: It retions | bo 31, doy of mo lh
2 YEPY!- Ip rabies 0 to 6 , Sandey te Selerdey .
qau fe Dec:
2 gal-pulleayt) Tr adieu digile yee” “ee
> gltewsor- De relurns © fe 25+
> alms Tt warns o fe Sa.
> qkseconds OF Tr rehuway 6 te 9-
> sekDali (1--31) 2ehg
ik an
> SekDay (0. 6) Sol, deli, doy, mou
=> Sale Month lo 1) yen:
=> sekpoll yeay (y,m,d)
SS Sdtteuws (0.-23) sadl
> sd otinules (0-523
=P Sel Seconds (0--S%)
> Sb Tie Caetimm : SS)
coy dat, hous, minulis $e
oud time
DB Array obgecl t~
Array Ga calledion dp ilims B elemenhs. 7”
Jevasevipl, Arrays ove cyraltd USing a Cpaciol raged
Syulon > 1 a
SiHfB oy Arvayomdent'e wes Avy LY:
Ex Vay number = mew Array Co) >
Scanned with CamS¢annershe Array obbgect Supports Fdlowing methods
| => push. Th is used te msert data into an Seve
—____l
once Me clea it pushed , ervey SO gets increased -
EX! humbevs push (9) 5
> pePO'- This used te xemove Mat elements tom om
ANY on
eres Ex numbers. popcs) 5
eta elements im AStendig
= Sk Ot DW is used & omreng
ovdey Ex’ umbawys -SevE OD)
| > reuse) 1 Tk Tevenses the elemnentt in an avvey.
|
| CE: Mumbars » mevert2O5
| cxampl'- Vay @hidenls = new
push ('seatha” J; Oe" "Rous", “mokany, ever, |
9, Seetha - |
Array (Rovi", “wolan, kites?
|
sate
Sli doukt- saat |
tr dewks -pop ("Moan") or” Ravi, ive
= ss
* Dymows ¢ ATML ktm Tevasen pl-i—
> DHTML ig o combination dh HTML, oyastvipt, ess
amd BomMLDuMmenk obseuk Medel): Th craolis Some
jiveive and aninelid usb ciles+
> Ty is dene aftiv loading MH page aud duwing
Te vremrkg POWs’ +
> DHTML coda i cifficull te be
debugged becouca it is a cate von
dewaloped and
ch veouigus Techorelat
Tht dynamic HTML prowides Valisiation qretess
> Dale valictabion s~
Validation & pr
cata wague be conraeck dali
@>
out oh ensuing ab ne
the povkeuloy apolicodion,
Scanned with CamScanneris aloud fo enfi
Dla volidsbty is ao PTOCSS TVs SOON Ko Usey
vy tee dota Pepired ky Te Byowtaats,
Exewngle s—
ete > validatins ,
esexipk lavguage = “gavosevige >
duncion validalt LD
t
Vey uname, ped, cpusd, emal |
uvemis chotuwmont, fams (“vin”). naw wel!
ped = doumask-faims Uebmit )sped volua
cprod = dovument-dant Cdamt')« pod. valu’
email = doumentsdéams (fomi’) - email. val
ab Canemese” I pod 2°" 1 cpa es 7 tend
alert U' ple enley alll aakedls"
4
eta cb Coname-longt 8)
cllerttUey name musk be aklentt & cleradkrs" )
i
else dll pod. logit < 6)
. ,
alevt C"patnodd must PS e\Gast 6 cherackir "),
3 i ‘
else cb Cped I= Cped)
t
Glourk: CY paseadds “didnt maken) s
5
, eble
t v ig
pone Succors* y
t
< lsempt >
thon =
Scanned with CamScannerZhody >
Zim nomes"cemi" >
Ztabl. align =" cenlix ">
adr >
el > usevname:
‘ ts. i
sina Wyee= "lex bE" name =" Oname” re tiagul >
Jd >
atd> Passwad +
ékA> cimpub (Gye =" passwd” nowe = pod® > toa
>
Ztr>
4id> confivm passat ,
Ltd>
alW>
2hd> E-mail: cid?
tad 20> :
<> :
weld cpa 2 ahi s Senne" >
inp type
Vewnail’ >
< Lame
| body >
2thiml>
1
Scanned with CamScannerConley pasted
Fe Even Handling th gave seviph f-
| once ry eveud is guadioltid , Mert & oft
Togutrawenk ty code te prowess Meso ever. suds cod
| Known as event houdley.
| rua allasatng aa. conmngrly vad Event have
| > onload i Th invokes aS Lonas o atv usb
douument uss loaded.
D> onekeK Ut Te Gvoket as toon as Hikenever OY &
) mm page: chen jane etic:
> menage O2- Be iwvotay wnewemey dala te ay #
Tm WTML. combol (tax Hany, FExloua ate)
geks chosged-
<> onDHleMtCKOI= ‘Tk Rv let Ushaneuey omy dt eo
alewests ove cliciad heotca- !
te TE Wu kel aS oom ah a UY
> on Meteo ir Tr tw i. met
mouse Potliv ower ay
Chmete. +4 all
Scanned with CamScannerJe TL imo kes AS Somat Tha Ute pelt Ma *
_s on subernit (
ubwik butloy 07 he wrth pogt:
“x gnnlead UTE Ine kos af Soom as a giveM wob
documart is cloted -
_> onkeyup Oty Tk tavokes at so) 0S) (aL US mendes
fe keys
Hs onkey Bren ct- Tk Ivokiel as Seow as We sey pas
Me Key.
~s onPluy (9 2- Ub Lvl ag Sonn at SY tack 8 date
urns Hay
| Example =
[ental m aan. wis “4h. -
|
ZANbl> Evert handlings
,
Zhody onload = alert (“Example 4 gouge eH Y >
cht align =" conkiy "> cyovasesph Evade >
chy] >
< (enput>
| Ontubbw dt Eve!
|
| aHorm>
|
i 7 opening ane ond chasing o_pindous!—
| Te cpay a new window, cus uxuabby suse 6
| Gain piickbimd gavasenpt Juncus.
| The -Hleuing sywlde is
windras s open UURL 'ysindas manu’) *
2
PUREE Hove we Supe Te ok Ta page
| P Hedow —mowes Ab spottiat Mi blmday nam:
| pea te Support Wipe Spa oh altabulas, Glee
|
|
Scanned with CamS¢annerniath > pmel
hoight ~ pmel
Socallbavs = YOS oF NO
th chsing ¢ teliddano Syne u |
Syudtcr Lbiydous close 6?
Exomple
Fe —
ehoad>
HHL hyde operabions ¢ Hitler
body >
Si nada”
<(wpub>
" Clate”
onclece =" winder Chase)’ > .
<>
[body >
2thbal>
Scanned with CamScannerBQ wet a gevasedet to
| Excengli prog’
| ot nok.
chind givem numba fy On
i
Amstong