saucer
1/22/2003 8:55:00 PM
where do you want to do the filtering? on the client side, you could try (of
course, you should still do the filtering on the server side):
noise.xml (make all noise words lower-case):
<Words>
<Noise>between</Noise>
<Noise>this</Noise>
<Noise>#</Noise>
</Words>
noise.html:
<xml id="noise" src="noise.xml"></xml>
<form name="form1" onsubmit="return doSubmit()">
enter words:<input type="text" name="txt1"><br>
<input type="submit">
</form>
<script language="javascript">
function doSubmit()
{
var s = document.form1.txt1.value.replace(/^\s+|\s+$/g,"").toLowerCase();
var a = s.split(/\s+/);
for (var i=a.length-1;i>=0;i--)
{
if (noise.documentElement.selectSingleNode("Noise[.='"+a[i]+"']") != null)
a.splice(i,1);
}
s = a.join(" ");
document.form1.txt1.value = s;
if (s == "")
{
alert("enter something interesting");
document.form1.txt1.focus();
return false;
}
return true;
}
</script>
"Yama" <yama@yamabiz.com> wrote in message
news:007101c2c249$ff7c42d0$d6f82ecf@TK2MSFTNGXA13...
> Hi all,
>
> I want to create a text box that will parse a set of
> words whenever intercepted.
>
> For example:
>
> In a textbox field I have before client clicks the Submit
> button:
>
> Between California
>
> In an XML file named noise.xml written as follow:
>
> <Words>
> <Noise>Between</Noise>
> <Noise>this</Noise>
> <Noise>#</Noise>
> </Words>
>
> I would like to call noise.xml match the word "Between"
> with my textbox. Then delete it so that I am left
> with "California" only.
>
> Anyone could help me get started?
>
> Thanks,
>
> Yama