prompt property (isindex)
Specifies a prompt message for the input field.
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:
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?
|
Example HTML code 2:
Recommendation:
|
||||
<hr /> Enter your search phrase: <input type="text" /> <hr /> |
||||
|
||||
Did you find this example helpful?
|
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?
|
Supported by objects:
HTML elements:
External links:
User Contributed Comments