Select (and copy) Form Element Script
Description: Allow your surfers to easily select the contents of your form elements- as we have done with our script containers throughout Dynamic Drive- with this script. And just to outdo ourselves, we've also embedded in this script the ability to concurrently copy the content to clipboard (memory) as well (applicable only in IE 4+). Enjoy!
Demo: Clicking on "Select All "will highlight the form's contents, and in IE 4+, copy them to clipboard as well.
Step 1: Insert the following script into the <head> of your page:
Step 2: Add the below sample form to the <BODY>:
That's a wrap.More info on configuring the script
The key to adding the "Highlight" feature to your form elements, as illustrated in the code of Step 2, are:
1) Giving your form a name (ie:
2) Giving the form element in question a name (ie:
3) Adding the <a> code:
directly above the form element, where the part in red
references the form, then the element to highlight's name (note the quotation marks around
it). Or if your form element contains an ID attribute, such as
id="select1">, you can simply enter that ID into
instead, such as