HTML JavaScript
HTML JavaScript
On this page
HTML JavaScript
HTML JavaScript Date and Time
<!DOCTYPE html>
<html>
<head>
<title>HTML JavaScript</title>
</head>
<body>
<h3>HTML JavaScript Date and Time</h3>
<button type="button"
onclick="document.getElementById('DateTime').innerHTML = Date()">
Click me to display Date and Time</button>
<p id="DateTime"></p>
</body>
</html> Inline JavaScript
Adding JavaScript in HTML
<!DOCTYPE html>
<html>
<head>
<title>Inline JavaScript</title>
</head>
<body>
<h4>Adding JavaScript in HTML</h4>
<button onclick="alert('Button Clicked')">
Click Here
</button>
</body>
</html> Internal JavaScript
Add JavaScript Code inside Head Section
Csias
<!DOCTYPE html>
<html>
<head>
<title>Internal JavaScript</title>
<script>
function myfunction() {
document.getElementById("InternalJS")
.innerHTML = "HELLO WORLD";
}
</script>
</head>
<body>
<h2>Add JavaScript Code inside Head Section</h2>
<h3 id="InternalJS" style="color: blue;">Csias</h3>
<button type="button" onclick="myfunction()">Click Me</button>
</body>
</html>HTML <noscript> Tag
HTML noscript Tag
Hello JavaScript
<!DOCTYPE html>
<html>
<head>
<title>HTML noscript Tag</title>
</head>
<body>
<h4>HTML noscript Tag</h4>
<p id="NameId"></p>
<script>document.getElementById("NameId").innerHTML = "Hello JavaScript"</script>
<noscript>Your browser does not support JavaScript!</noscript>
</body>
</html>