Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
9 views

Javascript Assignment 6

Unit 6 sppu entc javascript notes

Uploaded by

Madhura Peshave
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Javascript Assignment 6

Unit 6 sppu entc javascript notes

Uploaded by

Madhura Peshave
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

PAGE N0.

DATE:

ASSIGNME NT- 6
' i t a IS code to createa wcbpage wbtch.
creatce an account with proper validation.
<DOCrVPE htm>
<html ang
<head
Lmeta charset ="uIE-g">
<meta name = vlewpoxt' coptnt "wtdth =dtce
width, initial-scale : 1.0
<title > Create Account <htle>
<lhead >
<body >
<he>Create Account <lh2>
<form ld "siqnpozn" onsubmit s"rchusb
validate fozo)">
amUrey name: <labd>
<label for =LAernam
<Input type : "text id a'ucrham
"uscrDam reqçred ><br><by>

<label foy ="email">Email:<llabel


<Input type ='cmail jd= "email" Dame ="enail"

<label for ="pasu ord">Pasword i <llabel


Input type = "paAiw Ord" id : pastuoyd name=
"pausod rtquired zcbyLby>

<label for ="confirm Pasauard" Confnn Paus ocxd


<lbel
Ihput hyp. =paaw ord d: confirm Passusd"
hame = contrm PasSOTd xtquired >r Xb
PAGE NO.

DATE:

="subrmt">Creote Account<lbuttn
<huton type
<sccípt
function Validatefom 0
const pauiword dacumentqctElmentRyl
paord).value
const confimfastword sdocument.geitlemint By Td
(confmPasord) value
£Cpasuord =_conrmPaaword)
alert ("assuorde do hot match
etuzn false
alest ("Acount cratad succesfulyl :
zetun rus

<lsceipt>
<lbody7
Ubtol
0°2: Explainn
Ql2: retrencing fozn
form, subanitting form,
accesihq fozm Aeld

Referercing a foxmi
To referenc. a fozm in JavaScript .you
cap
we the document.fozmicolection
getElerment Ey I4'
foy txamplei

let forom doument. qet El Td


PAGE NO.
DATE

Submiting a Form:
A form cah
an be submiteed
cingtbe submitO'mdhod.Thisproqrammatically
can be donL
after performing some aidation:
fozm. submit ) ;
Accelaing Form Fieldh:
You Can accese foxm Aeld alng thelr
'name or Idd' attribute.
For cxamplsi
let CYbaMe. document.gt ElenertByMCuernamil.
value:
let email = form.enallvalue :

'3 alaite a TS code whidh ilustraty HTML


documeht hauing slgnup fozm
2lDocryPE htm
Zhtml ang ="en">
<head z
<metn charcet e "UTE -g"
meta name = "vieLaport" contnt "width= davice
wtdth, Initial- SCale =1.0">
Ctitle z Siqn Up Form Z/itHe>
<lhead
<body >
<he >stqn lp Ih2 >
<fomm id = "stqnup form
<label for ="WicINAMe emnamei</label
<input typc = "text" id "uACzhame
lsername ><br><br>
PAGE NO.
DATE:

<label for =emcul">Ero ail: </labd>


<Input type ="email ld= "email" hame a
ernail"> <br><br
pausword">Passwordilabel >
<label for =
har
="pauita Ord" ida"passu0d haamea
input type padsuord"><br>Lbr>

<button tåpe ="gubmit"> Slgn lp< lbutton


form
Kscript
docmant. qet ElernerntById('ignllp fozn).
add Eventliktener (suboit updtion. Cevent) i
event. Drevent De£ouult O:
alert("foxm submiBtedlO:

<lseript
<l body
<lhtm>

Q"al aite a JS code to create HTML fonm


dynamically.
2LDocTYPE blinl>
<html ang ="en">
<head>
<mcta_charsct=uTE -g"
(metaname =viewpozt"
= conknt =oidth =deia
width. inihal-scale =t.0">
tite >Ceate Dynamic Form <lhtle>
<lhead
<body
Ldiy ld = formn (ontainer><ldiy
PAGE NO.

DATE:

Lscript
conat fozm Contalntr_- docunet.qet Elem ent By Td
("fom Contalner"):
Const form = documcnt. createElemert (orm)
form id = "dynamtcfozm':
conat ltrDameLabel =docaurm cht.create Element
( labed"):
LAtrnameLabel. for "uuername";
seIDamLLabel-text ontent e "lscmame':
form.appcod Child (ucznamlabel )
=document.crcate Element('input
const uczham Irput
witznamaIrput. type "toxt"
ername pput.d = wername"
iername Ih put. name = "uczDam
form.append Chid (uCanamiInput):
(doumebt.creat El enent ("bz ).
form.appendChild
document.craate Elernent ('buttor
const submit Rutton ":
subit Button.type"submitSubmit":
cubmitBtton. textlontent
form,appenclkild (aubmit Buton):

Coptalner.appnd ChildCfozn):
formo
<Lscript

</htm
PAGE NO
DATE:

G"s Explan with example any tuo javasulpt


wlndoweventi
4windouw.anload'
Tbls cvent triggcnt when the cnttre conlento
thewlndo Ctncluding lmagea.suriph,and
iub framc a fly
hully loaded
window.onload = unchion.
alert Page fully loadudl):

2oindow. ongeize
Thic Cvent is hiqgeztd whenever the windo
tAized by he wser

oindouonztyize Ehunchon f
consolelog (lwtndaw relzed Nlea dimensiong:
+olndow. inntr JWidth +"X" twndo
LnnerHelght ):

Explarotron
oindow,ohloads uachul for exCcuting code
alter evenything te fully loaced. enaunng all
availabte

'oindow.nz&ize can be ued to dynamically


adjust layout
when the wndou
element on th page
alze chanqeg

You might also like