alert('Oh shit !!!! Javascript is disabled!!!! ');


Blog Archive

Prompt Box in JavaScript

Prompt Box in JavaScript

A prompt box is often used if you want the user to input a value before entering a page.

Step 1. Written below code in your application.

<html>
<head>
<script type="text/javascript">
function show_box()
{
var name=prompt("Please enter your name","Aditya Tiwari");
if (name!=null && name!="")
  {
  document.write("Hello " + name + "! How are you today?");
  }
}
</script>
</head>
<body>
<input type="button" onclick="show_box()" value="Show" />
</body>
</html>

Step 2. Run the Application. Click on Button.

You Entered in Website