What is an alert box? Write one code for javascript to display an alert box.
Answers
Answered by
11
An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click "OK" to proceed.
window.alert ("sometext");
_______________________ _ _
<html>
<body>
<p>Click the button to display an alert box</p>
<button onclick="myFunction()"> Try it </button>
<script>
function myFunction()
{
alert ("Hello world!");
}
</script>
</body>
</html>
______________________ _ _
Kokilaa:
Thank you Stager!
Answered by
2
<html>
<body>
<p>Click the button to display an alert box</p>
<button onclick="myFunction()"> Try it </button>
<script>
function myFunction()
{
alert ("I'm an alert box");
}
</script>
</body>
</html>
Similar questions