<html>
<body>
<p id="demo"></p>
<button type="button" onclick="Print()">Press Me!</button>
<script>
function Print() {
document.getElementById("demo").innerHTML = "Hello TutorialsLink!";
}
</script>
</body>
</html>
JavaScript
Program to print using onclick function.

Written by
View ProfileNikhil Juneja
Passionate software developer and technical contributor at TutorialsLink.
