-Alerts:
- Most of the times while you are using the internet and moving between the website some of them shows up a Popup boxes to tell you something maybe an error in the signup registration or a wrong value of any field
- Its very good to use them but remember it might be annoying for some users so i prefer you just use it to get your errors not to show it to the user because the user wont get the language of the browser but you can handle it
- the Popup boxes model change from a browser to browser.
- all these functions are all methods of the Window object
- First you should know that you can use it without the window prefix
- it get a parameter for the text you want to show
- remember you can use it without the "window." part.
and it'll show like this:
-Confirm Box:
- You can use this box to ask your user and get the answer for example ask him to leave the page or not
- To get the user answer we should have a value and this one is a boolean so if the user click ok it'll return "True" if the user click cancel this method will return "False"
it'll show this:
if you press ok it'll redirect you page to Google put if you press Cancel you'll get another Popup box but its an alert that you pressed Cancel
-Prompt Box:
- If you want to ask the user about username or email before going the his destination you should prompt his username and check if its true for example we want the user have a username "Basel"
- this method get to parameters one of them is the text you want to show in our example is"please enter your username" and the second parameter is the default text in the text box and you can leave it empty
it'll show you this:
if you enter Basel it'll show "Successful" if you didn't obviously it'll show "Failed"
-Related to this post: