Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
You are here: Reference > JavaScript > client-side > HTML DOM > properties > prompt (isindex)

prompt property (isindex)

Browser support:
Specifies a prompt message for the input field.
The isindex element and all of its properties are deprecated. Use the input:text element instead.
Note that the browser support of the prompt property in JavaScript and the browser support of the prompt attribute in HTML are different. While the prompt attribute is supported by all commonly used browsers, the prompt property is not supported in Internet Explorer. For details, see Example 2.

Syntax:

object.prompt;
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: prompt

Possible values:

String that sets or retrieves the prompt message.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the prompt attribute:
<isindex id="myIsIndex" prompt="Enter your search phrase: "/>
Did you find this example helpful? yes no

Example HTML code 2:

Recommendation:
<hr />
Enter your search phrase: <input type="text" />
<hr />
Did you find this example helpful? yes no

Example HTML code 3:

This example illustrates the use of the prompt property:
<head>
    <script type="text/javascript">
        function SetPrompt () {
            var isIndexElem = document.getElementById ("myIsIndex");
            var input = document.getElementById ("myInput");
            if (isIndexElem.prompt) {
                isIndexElem.prompt = input.value;
            } else {
                // in Internet Explorer
                isIndexElem.previousSibling.data = input.value;
            }
        }
    </script>
</head>
<body>
    <isindex id="myIsIndex" prompt="Enter your search phrase: "/>

    Type a new prompt message
    <input type="text" id="myInput" value="new prompt message" />
    <button onclick="SetPrompt ();">Set prompt message!</button>
</body>
Did you find this example helpful? yes no

Supported by objects:

External links:

User Contributed Comments

Post Content

Post Content