var str1 = document.getElementById(“W1”);
str1.textContent = “Welcome “ + tname + “!”;
}
}
</script>
</body>
</html>
Output:
10. Write JavaScript code to display the date and time on the webpage.
Ans. <html>
<head>
<title>Date and Time Display</title>
</head>
<body text=blue>
Practical Work 275