Skill Making

Always Increase Your Knowledge

Use of Prompt Box in JavaScript | Use of JavaScript with HTML

Use of Prompt Box in JavaScript | Use of JavaScript with HTML

 

In this article, I will share some information about JavaScript. Here you will get information about Use of Prompt Box in JavaScript. If you want to learn the use of the prompt box then you should read this article till the end. I hope you will love it.

What is Prompt Box in JavaScript?

How to use a prompt box in JavaScript?

How to use JavaScript with HTML file?




If you also having these questions then you should read this article till the end. Here you will get information about the use of Prompt Box in JavaScript.

You should also Read these articles:

Use of Alert Box in JavaScript

Use of Confirm Box in JavaScript

If you want to boost your JavaScript Programming knowledge then you must read this book. It will be helpful to grow your knowledge of JavaScript.

Prompt Box in JavaScript

  • A prompt box in often used if you want the user to input a value before entering a page.
  • When a prompt box pops up, the user will have to click either “OK” or “Cancel” to proceed after entering an input value.
  • If the user clicks “OK” the box returns the input value. If the user clicks “Cancel” the box returns null.
  • prompt(“message”,”defaultValue”);
  • Here the second argument “defaultValue” is optional. You can skip this argument.

Example:

<!DOCTYPE html>

<html>

<head>

<title>Pop Up Boxes</title>
<script type="text/javascript">
 var x=prompt("Enter a value: ","3"); 
if(x!=null)
{
 for(i=1;i<=10;i++)
 document.write("<br/>"+x+"x "+i+"= "+x*i);
 }
 </script>

</head>

<body>






<h1>Welcome</h1>
</body>



</html>

The output of Prompt Box:

Picture of Prompt Box in JavaScriipt    Picture of Prompt Box in JavaScriipt




Conclusion

Finally, you got information about the use of the prompt box in JavaScript. I hope you got some useful article. If you find it helpful then please share it with your friends. Thank you for reading this article till the end.

Leave a Reply

Your email address will not be published. Required fields are marked *

Skill Making © 2018 Frontier Theme