|
|
Subject:
"For secret901-ga only" Create a JavaScript that will fix <br> problems
Category: Computers > Programming Asked by: paul6-ga List Price: $15.00 |
Posted:
11 Oct 2002 10:57 PDT
Expires: 10 Nov 2002 09:57 PST Question ID: 75351 |
NOTE: ANYONE OTHER THAN "secret901-ga" THAT ANSWERS WILL BE REJECTED!!! ############################################################## Hello secret901, would you please create a JavaScript for me that will remove all "<br>" type elements in a "text box". I have provided an example at http://www.pdawax.com/GoolgeHelp.html. Would you also make it so that this script can be used for other html files. What I mean, if I want to use this for another html page (which I will) it will be for a different name field(s). I'll need to know how to modify the script to work with different fields (naming). but if your script will work for any field just tell me. This script will need to work for PC, Macintosh and Unix. Thanks BTW: thanks for pointing out that contact between users out of Answer Google is prohibited. | |
| |
| |
|
|
Subject:
Re: "For secret901-ga only" Create a JavaScript that will fix <br> problems
Answered By: secret901-ga on 11 Oct 2002 20:06 PDT Rated: |
Hi Paul, Below is the updated code for the script that is fixed for Macintoshes. (I made changes to only one line. If it doesn't work this time, revert to the old version.) To use the code in any HTML file (with a form) that you wish, just paste it onto the head of the file, and in the <body> tag add onLoad="editPage();" As I stated before, this code does not depend on any field name (it just traverse through a whole list of fields), so there should be no problem adapting it. If you have any installation problems with this code, please let me know and I'll be happy to clarify. Have a great weekend, secret901-ga <script language = "Javascript"> //Begin code //Javascript to remove breaks in text areas //October 10, 2002 //Made for Google Answers function editPage() { var formArray = document.forms; for(var i = 0; i < formArray.length; i++) { var currentItem; for(var j = 0; j < formArray[i].elements.length; j++) { currentItem = formArray[i].elements[j]; if(currentItem.type == 'textarea') currentItem.value = removeBreaks(currentItem.value); } } return true; } function removeBreaks(aString) { var newLine = (navigator.appVersion.lastIndexOf('Win') != -1) ? "\r\n" : "\n" return aString.replace(/<BR>/gi, newLine); } </script> |
paul6-ga
rated this answer:
As usual "secret901" did an excellent job. His/Her (?) code is very clean and works the first time, which implies to me that he/she (?) test it before his/her (?) post. Which would seem logical, but sometime people just quickly make a post to get paid (Ive had first-hand experience before with that happening). Thanks again secret901 for you assistance. |
|
There are no comments at this time. |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |