METHOD:  Window::prompt

window.prompt(message[, defaultInput])

This method displays a dialog box prompting the user for some input. The optional defaultInput parameter specifies the text that initially appears in the input field.

The following example prompts the user for their name and then writes a personalized greeting to the page.

<body onload=greeting()>

<script language="JavaScript">
function greeting() {
    y = (prompt("Please enter your name.", "Type name here"))
    document.write("Hello " + y)


Copyright 1999-2001 by Infinite Software Solutions, Inc. All rights reserved.
Trademark Information