secnpt>
TASK 3: Greate JavaScript code in the and
1_Gyeate and un the folowing JavaSerist code
SIOOGTYPE himi>
shead>
tiie» Sonpt in head and bady section :
‘
doctiment wntein('Good Morning’),
‘
sitead>
alen("Good Evening)
‘sfboay>
tht:
TASK 4 Greate and run sample JavaScript code.
1 Greate and run the folowing JavaSenpt code
(“ = —s—“‘“CSC;C;C;!;*~*@
hime
“sh id "header-rOldHeadersiniz
Click the following to see the result:
Click Me
Click the following to see the result:
Fad
™ cop: x \ EB cor: x \ @ dave: x \T lean x @ Java: xD) Ener x Y 1) Eo: x
}Owork/ErrorHandling2 html
This page says
TASK 3: Use throwin javaseript
1 Open Notepad
IT & ITES: COPA (NSOF- Revised 2022) - Exercise 132.117
2. Typethe following code
69‘
-eenpttype"tentjavasengt’>
ee VEEL ‘=p>Clink the following to See the reault
i forms
saree ‘ 7 Close Notepad
‘wondow enecror =tuhation 0 { ‘a NW run the fami fae 18 see the eeu (Fig 7)
‘alert("Anerror occurred"), 9 Glick the Click Me button (Fig-8)
)
~
image2.s:
imagel sre:
Click save
Type Mlename as animation3.ntrl
Select Tle type as all nies
Select destination in desctop or other location. Click
save
Close Notepad
Now run thentmi ile to see the result (see Fig:3)
Output
Figs
| Move your meuse over the mage to see the result
mane
HTML
ai
IT & ITES: COPA (NSGF- Revised 2022) - Exercise 132.119 7IT&ITES
Exercise 190.420
COPA - JavaScript Embed JavaScript in HTML Pages
Develop dynamic HTML pages using JavaScript
‘Objectives: At the end ofthis exercise you-shall be able to
+ leam how te develop dynamic HTML Pages using JavaScript.
Requirements
‘Tool sEquipment/Machines
+ Avorking PC with Windows
O.5., Text Eattar (Notepad) &
Browser
= 1 No sbaten,
PROCEDURE
TASK 1: HTML Java script
1 Open Notepad,
2. Typethe following cade
shea
tithe
Methed ofa JavaScript
body
acript types"tentfjavaseript>
‘docurnentavite(“JavaTpeint'y,
-facripts
‘ethtnt>
Click Save.
‘Tyne flename as page! him
‘Solact fa type as All Files.
Select destination in Desktop or any other location,
Click Save.
7 Close Notepad
aos
TASK 2: JavaScript and HTML event
8 Now goto the fle destination
9 Double Chick ttonun.
40: Browser can show you’a warning,
{1 fivarning is shovi. click yelloe raming bar.
12 Select Allow Blocked Content,
13 A security waming can be shown,
14 Click yes,
15 New click “Try tt to run the javascsipt code in the
page
16 Hello Worldevould be shown as output
{ Ref Steps 1 to 16-Task1
Shimi=
shear
tities
78
DHTML with JavaScript
-
“sscript ype="textjavaseript’>
function checkGrade) (
var xp, toxt;
p= dotument getBlemantByla"percentage”} velue;
aparsebntip)
ifir00 88 x <= 100){
document geiBlemantBylddemc”) innarHTML =|
Sas
pelseif(o80 £2 x <=90){
document getElement yld("demo") innerHTML =|
at
False if (e270 88 x <= 80)
document getilemantByldi"demo") innerHiThiL. =
“23%,
ec Saeed
56 Ope paemnammn ow QF
em prciege a Sie:
av
IT RITES: COPA (NSOF -Roviced 2022)- Exercise 1.32.120hin
heed>
atlas
getElement Byid.style.croperty example
ehoad>
=p id="demo'> This tat changes color whan click
-onthe fellowing different buttons.
“button enclick="changs_Colen'green’)"> Green Biue