Prompt and Alert Boxes (Javascript tutorial #16)

in blurtutorials •  4 years ago  (edited)

We have already talked about alert messages but today we will se how to create a prompt boxes and use the data used in prompt box into alert messages to create a welcome message for any user coming on our web page.

images_20201023001732196.jpg

So let's get started...! It will going to an easy one today.

Step 1 : create a html structure just like all the other tutorials.

Step 2 : Create following script tag and write the code as it is. This is infinite loop using for loops.

Screenshot from 2020-10-23 00-06-20.png

Step 3 : Run your html file with a browser and then see the result.

Screenshot from 2020-10-23 00-09-59.png

Step 4 : Write your user name here for example if i write @sct.blurt.

Screenshot from 2020-10-23 00-06-37.png

Step 5 : Welcome message will be printed for @sct.blurt.

Screenshot from 2020-10-23 00-06-42.png

Full Code :

Screenshot from 2020-10-23 00-06-21.png

Prompt is a predefined function in Javascript that is used to prompt a message box on the screen.

Ask Your doubts in the comments below

Thank You...!


Links to all the tutorials are shared below

  1. Javascript , Alert Message
  2. Lets Play with buttons Using Javascript
  3. How To Change Html content using Javascript
  4. Data Types And Variable in Javascript #1
  5. SWAPPING TECHNIQUE IN JAVASCRIPT
  6. OBJECTS IN JAVASCRIPT #1
  7. OBJECTS IN JAVASCRIPT #2
  8. OBJECTS IN JAVASCRIPT #3
  9. ARRAYS IN JAVASCRIPT #1
  10. If and Else Statements in Javascript
  11. FOR LOOPS IN JAVASCRIPT
  12. FOR LOOPS WITH IF and ELSE
  13. ERRORS IN JAVASCRIPT
  14. WHILE LOOPS IN JAVASCRIPT
  15. INFINITE LOOPS in JS
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE BLURT!