How to use warning command? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to use warning command?

Can anybody tell me how to use the warning command in HTML JavaScript

29th Oct 2017, 1:37 PM
Lux Official
Lux Official - avatar
2 Answers
+ 5
<html> <head> <script type="text/javascript"> <!-- function getValue(){ var retVal = prompt("Enter your name : ", "your name here"); document.write("You have entered : " + retVal); } //--> </script> </head> <body> <p>Click the following button to see the result: </p> <form> <input type="button" value="Click Me" onclick="getValue();" /> </form> </body> </html>
29th Oct 2017, 1:47 PM
MsJ
MsJ - avatar
+ 4
Thanks to @Mohit, I guess you're talking about pop up boxes? There are three type: > alert() to just show a message to user, waiting for validation (only one buttons: ok) > confirm() to display a message and get a boolean user response (two buttons: ok/cancel) > prompt() wich display a message and expect a value (string) from user (two buttons: ok/cancel) https://www.w3schools.com/js/js_popup.asp
29th Oct 2017, 2:00 PM
visph
visph - avatar