provided by: 
Originally published at Internet.comTip Forty-Tree...
I have found that one of the hardest things about writing a JavaScript is trying to set up code so that every possible thing a user could do is handled in one way or another. I always forget something.
The author of this script put in some code that I would never have thought of. Many of you know that when using a search engine, a plus sign (+) between words is a good idea to help to search. Today, we look at the code that searches the keywords entered in this script. If a space is found, then a plus sign replaces it.
But first, refresh yourself on the effect and code of this Script.
-----------------------------------
Enter the Keyword :
Select the Search Engine(s):
Yahoo
Altavista
WebCrawler
Excite
Lycos
-----------------------------------
Here's the Code
-----------------------------------
I am worried about the code that makes up the first function, wordsplit(items). It looks like this:
function wordsplit(items) { var charect = ""; for (var n = 1 ; n <= items.length ; n++) { if (items.substring(n-1,n) == " ") { charect+="+"; } else { charect+=items.substring(n-1,n); } } return charect; } ...
Read article at Internet.com site