Button In JavaScript Example
JavaScript Button Example Onclick you will get an alert message, you can try it by saving as an .html file and open in any browser.Source Code
<!DOCTYPE html><html>
<head>
<title>alert</title>
</head>
<body>
<p>JavaScript</p>
<button onclick="alert('Hello! You clicked me!')">Click Me!</button>
<button id="button2">Click Me!</button>
<script>
document.getElementById("button2").onclick=function(){
window.alert("You have just clicked me!");
}
</script>
</body>
</html>
No comments: