0% found this document useful (0 votes)
4 views11 pages

Chapter 6 Assignment 3

The document contains a web design and development assignment by Tahreem Rafaqat, showcasing five JavaScript programs. Each program demonstrates different functionalities such as displaying messages, using prompt and alert boxes, performing arithmetic operations, and utilizing relational operators. The assignment is submitted to Sir Sheraz Tariq for the 5th semester.

Uploaded by

223317
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)
4 views11 pages

Chapter 6 Assignment 3

The document contains a web design and development assignment by Tahreem Rafaqat, showcasing five JavaScript programs. Each program demonstrates different functionalities such as displaying messages, using prompt and alert boxes, performing arithmetic operations, and utilizing relational operators. The assignment is submitted to Sir Sheraz Tariq for the 5th semester.

Uploaded by

223317
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/ 11

WEB DESIGN AND

DEVELOPMENT
Assignment #03

Tahreem Rafaqat
Name

ID 223317

Semester 5th

Summited to Sir Sheraz Tariq


Program 1
Code:
<!DOCTYPE html>
<html>
<head>
<title>Welcome to JS Program</title>
<script type="text/javascript">
document.writeln(
"<h1>Welcome to JS first program!! <br> Web programming is amazing.</h1>"
);
</script>
</head>
</html>
Output:
Program 2
Code:
<!DOCTYPE html>
<html>
<head>
<title>Printing line with multiple statements</title>
<script type="text/javascript">
document.writeln("<h1 style =\"color :magenta\">");
document.writeln("Welcome to JS first program!! <br> Web programming is
amazing.</h1>");
</script>
</head>
</html>
Output:
Program 3
Code:
<!DOCTYPE html>
<html>
<head>
<title>Using prompt and Alert Boxes</title>
<script type="text/javascript">
var name;
name = window.prompt("Please Enter your name here :");
document.writeln("<h1 style=\"color: blue\">");
document.writeln("Hello, "+ name + " And welcome to JS programming</h1>");
</script>
</head>
</html>
Output
Program 4
Code:
<!DOCTYPE html>
<html>
<head>
<title>An Addition program</title>
<script type="text/javascript">
var firstnum;
var Secondnum;
var Thirdnum;
var num1;
var num2;
var num3;
var sum;

firstnum = window.prompt("Enter the first integer :");


Secondnum = window.prompt("Enter the second integer :");
Thirdnum = window .prompt("Enter the Third integer:");

num1 = parseInt(firstnum);
num2 = parseInt(Secondnum);
num3 = parseInt(Thirdnum);

sum = num1 + num2 + num3;


document.writeln("<h1> The sum of the three integers are " + sum + " </h1>");
</script>
<body>
<p>click reload to run the script again.</p>
</body>
</head>
</html>
Output:
Program 5
Code:
<!DOCTYPE html>
<html>
<head>
<title>Using Relational Operators</title>
<script type = "text/javascript">

var name; // string entered by the user


var now = new Date(); // current date and time
var hour = now.getHours(); // current hour (0-23)

name = window.prompt( "Please enter your name" );

if ( hour < 12 )
document.write( "<h1>Good Morning, " );
if ( hour >= 12 )
{
// convert to a 12-hour clock
hour = hour - 12;

if ( hour < 6 )
document.write( "<h1>Good Afternoon, " );

if ( hour >= 6 )
document.write( "<h1>Good Evening, " );
} // end if

document.writeln( name +
", welcome to JavaScript programming!</h1>" );
</script>
</head>
<body>
<p>Click Refresh (or Reload) to run this script again.</p>
</body>
</html>
Output:

You might also like