Let’s write a piece of script and for doing that we first make HTML file (web page). Open your code editor and Create new file with .html extension (i.e jstoast.html). If you are new to coding and web development, I highly recommend you to take a look on another toast about setting up your environment for start web development using Sublime Text Editor.
Create an html document
</pre> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Alert Function</title> </head> <body> </body> </html> <pre>
</pre> <body> <script> </script> </body> <pre>
<script> alert(); </script>
We simply call a built in function named ‘ALERT’. A function is a command that does something specific. ALERT function opens a pop up window in browser. Please note that we place a semi-colon at the end of the line which is must.
We will write the information in that ‘ALERT’ function that we want to specify in that pop up window.
Please note that the information is close in parenthesis ( “ “) . This will write “Hi There” in the pop up window. Try that
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Alert Function</title> </head> <body> <script> alert("Hi There"); </script> </body> </html>