DevelopPHP
home Forum gear home

Libraries book

HTML Library CSS Library JavaScript Library PHP Library

Videosbook

PHP and MySQL JavaScript HTML and CSS Vector and 3D Flash Actionscript Android Dev Miscellaneous

Resourcesbook

Website Hosting
window.prompt Method Javascript DOM   Share / Like

The prompt method of the window object is used to render a dialog box that requests text needed to proceed with a particular action that the script is about to perform. It also gives the user the ability to cancel the action if they wish to.

SYNTAX window.prompt( messageToUser, defaultValue )

Parameters

messageToUser
Message that appears above the input text field in the box.

defaultValue
Optional default value pre-inserted into the input text field in the box.

 

Javascript CODE EXAMPLE
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function myPrompt(){
    var promptValue = prompt('Supply text:', 'optional default value');
    if(promptValue != null){
        document.getElementById("status").innerHTML = promptValue;
    }
}
</script>
</head>
<body>
<p><input type="button" value="Supply Value" onclick="myPrompt()"></p>
<h3 id="status">status...</h3>
</body>
</html>
 

status...

 

Related Material

alert()
confirm()

Home   •   Terms of Use   •   Developer Forums   •   T-Shirts   •   RSS   •   Classroom Chalkboard   •   Donate   •   Top ↑
Popular In PHP / MySQL E-Commerce Store Production
Social Network Website Building
Image Upload / Photo Processing
CMS Software Programming
Mass Email Systems
Magic XML Data
Search Programming
Popular In JavaScript JSON Programming
Ajax Programming
Animating Elements
WYSIWYG Programming
Date/Time Programming
DOM Scripting
Object Reference
Popular In HTML Canvas Element
New Form Elements
Audio Element
Video Element
Drag and Drop
Event Handling
Element Grouping
Popular In CSS Custom Font Embedding
Dynamic Fit Backgrounds
Theatre Mode
Box Overlays
CSS Level 1 Properties
CSS Level 2 Properties
CSS Level 3 Properties
©2013 DevelopPHP   |   Navigate to related domains HTML5