You no longer need to provide large textareas in your forms. This script will resize textarea boxes to fit the text in them.
We have tested the code in IE7.0, Firefox2.0.0.1, Opera9.10, Netscape8.1.2 and AOL Explorer1.5. This script worked well in all platforms with one (1) variation observed in Opera9.10.
Default
<form> |
Reconfigured
<form> |
Depending on your knowledge of HTML and javascripts, this is an easy two (2) part copy and paste code that goes in both the <HEAD> and <BODY> sections (incorporated into a working form) of your document. It also makes use of an external .js script you need to save and upload into your directory then add a snipplet of code into the <HEAD> section to call the external.js file.
Note Of Importance: If you are not sure of howto make the external .js file and make use of it within your document, grab the below link and it is fully explained.
[ .js File Howto ]
For your Information:
If you are not comfortable or prefer not to use the external.js file, you can use the traditional cut/copy and paste instead of the external .js file. If you need a little refresher on what is required to achieve this, grab the below link and it is fully explained.
[ Traditional Cut/Copy and Paste ]
Depending on which of the above methods you have selected (external.js file or Traditional Copy/Cut & Paste), you will add either the snipplet of code (after you have uploaded the external.js file) into the <HEAD> section or the completed section of code that you added the opening and closing script tags.
<script type="text/javascript" src="textAreaSizer.js"> </script> <SCRIPT LANGUAGE="JavaScript"> <HEAD> Section of code goes here // End --> </script> |
External .js file Traditional Copy/Cut & Paste Code with opening & closing tags that you had to add into the <HEAD> section of code that was originally earmarked to be an external .js file. |
If you would like to see an example of this effect using the "Traditional Cut/Copy & Paste" method, grab the below link and you are there. Examine our "Source" code (on the page you will be opening) to see how we had to reconfigure it to make it work. We have it very well documented for your convenience.
[ Traditional Cut/Copy & Paste Method ]
O nce you have completed either of the above steps for the <HEAD> section, all that is left is to incorporate the <BODY> section of code into a working form.
Note Of Importance If you are going to have this effect incorporated into a form that is on a page with a "Close Window" form button, the effect will "Not" function correctly. What we mean is that the textarea box will not expand as more text is inserted. You will get a scrollbar instead. A work-a-round is quite simple. Instead of the form button to "Close Window" use a "Javascript" link instead. If this is a little unclear, see the below examples to clarify it further.
Incorrect Close Window (Button) <form> |
Correct Close Window (Link) <a href="javascript:window.close();">Close Window</a>Close Window |
We hope our tutorial was easy to follow and we covered everything in detail. If you would like to add this effect into your pages, grab the respective below link and you are there. If you have any problems with this or anything else, feel free to consult our [ FAQ ] and if you can't find the answer there, [ contact us ].
[ Get Code Here ]
[ Rate This Page ]