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

Program 4

The document contains two HTML files: 'Date.html' which displays the current date when a button is clicked, and 'multable.html' which prompts the user for a positive number and displays its multiplication table in an alert. Both scripts utilize JavaScript for their functionality. The first file focuses on date display, while the second emphasizes user input and multiplication calculations.

Uploaded by

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

Program 4

The document contains two HTML files: 'Date.html' which displays the current date when a button is clicked, and 'multable.html' which prompts the user for a positive number and displays its multiplication table in an alert. Both scripts utilize JavaScript for their functionality. The first file focuses on date display, while the second emphasizes user input and multiplication calculations.

Uploaded by

sigcegroup
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

PROGRAM:

a) [Link]
<!DOCTYPE html>
<html>
<body>
<script>
function display() {
var x = "You have clicked";
var d = new Date();
var date = [Link]();
var month = [Link]() + 1; // Month is zero-based
var year = [Link]();
[Link]("dis").value = date + "/" + month + "/" + year;
}
</script>

<form>
<input type="text" id="dis" /><br />
<input type="button" value="Display Date" onclick="display()" />
</form>
</body>
</html>

Output:

b) [Link]
<!DOCTYPE html>
<html>
<head>
<title>Multiplication Table</title>
</head>
<body>
<script type="text/javascript">
// Ask for a positive value
var n = prompt("Enter positive value for n:", "");

if (!isNaN(n) && n > 0) {


var table = "";
for (var i = 1; i <= 10; i++) {
var number = n * i;
table += n + " * " + i + " = " + number + "\n";
}
alert(table);
[Link](n + " table values displayed using alert..<br/>");
} else {
alert("Enter a positive value!");
}
</script>
</body>
</html>

Output:

You might also like