HTML
<button onclick="sayHello()">Click Me</button>
JavaScript
function sayHello() {
alert("Hello! You clicked the button.");
}
Explanation:
onclick
calls thesayHello()
function.alert()
shows a popup message.
HTML
<button onclick="sayHello()">Click Me</button>
JavaScript
function sayHello() {
alert("Hello! You clicked the button.");
}
Explanation:
onclick
calls the sayHello()
function.alert()
shows a popup message.
Leave a Reply