Professional Documents
Culture Documents
Assignment 2
Submitted By
Muhammad Ali (18514)
Submitted To
Ali Haider
BS (IT)
6th Semester
Spring-2023
For Show Text in a HTML paragraph, display text() function will be called
Change Text of HTML paragraph, change text() function will be called
To Change Colour of a text, change colour() function will be called
Change Text size of html paragraph, change size function will be called
Function contains if/else condition to get its previous size
Output:
Lab Task 2
BULB ONN/OFF
Output:
On:
Lab Task 3
Create a Calculator
Create separate CSS and Javascript file and link them in head tag
Now create parent div (main_div), add three more divs in parent div for heading,
input field and third one for calculator buttons etc • Add class Field to style input field
of calculations • Set buttons type Submit and add class btn for their styling
Output:
Lab Task 4
Alarm Clock
Create main div (wrapper) and add another child div (inner-wrapper)
Add multiple divs like one for clock image, for heading, one div for select input fields
for hours, minutes and ap/pm and last div for set alarm button
Add styling to mentioned classes of divs such as centering main div (wrapper), background
color and set alarm button
Now for javascript operations first take a const variable and access heading tag, select
fields and button through querySelector and two let variables to set alarm and
ringtone
Take three for loops for hours, minutes and am/pm and apply if/else condition through
ternary operators, set the values in temporary variable to display in HTML option tag
Calling javascript built in function setInterval as an arrow function, get hours, minutes
and seconds from built in function Date() and store their values in given variables
Through innerText display the current time in HTML heading and in last check
alarmTime variables is set then pass true value to ringtone variable to start
Now in last call setAlarm function and apply if/else condition to check whether the alarm is
set or not, if it is set then change variable values which will display during set time and if it is
not then assign values which will be shown when its not set
Output: