Modifying existing script to add a word before the first word in an input field and add words in the spaces between the other words confused read on...
Posted on 2004-10-13
var sText = theForm.SIMPLE.value.toLowerCase();
var sText = sText.replace(/<THESAURUS>/gi," ");
var sText = sText.replace(/\s+/g," ");
var vWords = sText.split(" ");
var stringOUT = vWords.join("<THESAURUS>");
theForm.SIMPLE.value = stringOUT;
<form NAME="theForm" METHOD="POST" ACTION="/cgi-bin/webcgi.exe">
<INPUT TYPE=TEXT NAME=SIMPLE VALUE='###REPORTED_QUERY###' SIZE=40 style="width:300px">
I need to modify the above script currently it looks for spaces in the string and then add's a <THESAURUS> between the words and submits the form.
I need to modify this so that
the first word is prefixed by <THESARUS> and other words use the existing logic to add <AND><THESAURUS> so the following
dvd surround sound