INTERNET CONCEPTS AND WEB DESIGN MCSL 016
This is a code for Ignou previous question paper solution.
Write JavaScript code to print date.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Print Date</title>
</head>
<body>
<h1>Print Date</h1>
<button onclick="disp()","dispt()">Date</button>
</body>
<script>
function disp(){
var d = new Date();
var d1 = d.getDate();
var d2 = d.getMonth()+1;
var d3 = d.getFullYear();
document.write(d1+ "-" + d2 + "-"+ d3)
}
</script>
</html>
No comments:
Post a Comment