<html>
<body>
<h1>My First JavaScript</h1>
<p id="demo">
JavaScript can change the content of an HTML element.
</p>
<script>
function myFunction()
{
x=document.getElementById("demo"); // Find the element
x.innerHTML="Hello JavaScript!"; // Change the content
}
</script>
<button type="button" onclick="myFunction()">Click Me!</button>
</body>
</html>
hasilnya
My First JavaScript
JavaScript can change the content of an HTML element.
Tidak ada komentar:
Posting Komentar