You have your site search set up and now you want to snaz it up a little.
This little JavaScript Function will allow you to place text within your input box, then when the user clicks to enter something the default text will disappear allowing them to directly enter their information;
Step 1:
If you are placing your input box on every page (or more than one page) you should place the script function in the MasterBorder HTML insertion location. Press F10 to bring up the MasterBorder Properties palette press the HTML button at the lower right, then in the tab marked Between Head Tags Insert the following JavaScript Function

View the text file containing this script function
Step 2:
After Placing your Forms Edit Field from the Forms Tool Bar enter the text you wish to display in the Forms Edit Field Properties palette input box marked Text. You can off set the text from the left side of the Forms Edit Field by pressing the enter key to give it some padding, you can also center the text in the Edit Field by adding or removing leading spaces as show in the example below
Once you have your default text in your Forms Edit Field then press the HTML button located at the bottom right of the Forms Edit Field Properties palette and in the tab marked Inside Tag enter the following JavaScript Code which will call the Script Function that you placed in your Head in Step 1 above
onFocus="doClear1(this)"
Your input box will look and act like the example below. The script function checks that the default text is entered and if the user enters something the script will not clear it. Only the default text will be cleared
Did you find this tutorial useful? Do you want to keep this resource online? Make a donation to keep gotFusion alive
This page was written by and is maintained by turtle
|
|