October 2018
Intermediate to advanced
192 pages
5h 12m
English
The following is the code to generate a simple modal alert in JavaScript. This alert in the code will appear on the main page and one cannot access the main page in the background until either the OK or Cancel button is clicked:
<html> <head> <script type="text/javascript"> function display_alerts(){ var text1; if (confirm("Click")) { text1 = "Ok was pressed"; } else { text1 = "Cancel was pressed"; } document.getElementById("disptext").innerHTML = text1; } </script> </head> <body> <input type = "text" id = "text1"/> <input type = "button" onclick="display_alerts()" value="Display Alert" /> <p id="disptext"/> </body></html>
The following is the code to generate a simple non-modal alert in jQuery. This ...
Read now
Unlock full access