ICT Worksheet 1
ICT Worksheet 1
<!DOCTYPE html>
<html>
<body>
<script type = "text/javascript">
/*
var a = 33;
var b = 10;
var linebreak = "<br />";
C. Directions: (15pts)
1. Copy and paste the source code and save it as html file, with a file name
addProg#1 .
2. Add a comment in each line to describe the function of each syntax.
3. Provide the complete output in the box provided.
<!DOCTYPE html>
<html>
<head>
<title>First Adding Program</title>
</head>
<body>
<script type="text/javascript">
var a
var b
var c
a=prompt("Please enter a number:",0)
b=prompt("Please enter another number:",0)
c=parseFloat(a) + parseFloat(b)
document.write("The sum is:",c)
</script>
</body>
</html>
Output:
D. Directions: (20)
1. Copy and paste the source code and save it as html file, with a file name
addProg#2 .
2. Add a comment in each line to describe the function of each syntax.
3. Provide the complete output in the box provided.
4. Analyze the difference between addProg#1 & addProg#2. Type your
answer in one paragraph.
<!DOCTYPE html>
<html>
<head>
<title>Adding Program</title>
</head>
<body>
<script type="text/javascript">
var a=0
var b=0
a=prompt("Please enter a number:",0)
b=prompt("Please enter another number:",0)
c=parseInt(a)+parseInt(b)
document.write("The first value:",a)
document.write("<br>The second value is:",b)
document.write("<br>The sum of the two values is:",c)
</script>
</body>
</html>
Output: