[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Yama Kamyar

1/22/2003 8:10:00 PM

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
2 Answers

saucer

1/22/2003 8:55:00 PM

0

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


Yama Kamyar

1/22/2003 11:05:00 PM

0

Thank you Saucer! You really got some parsing skills up
your sleeves. :-)

Yama

>-----Original Message-----
>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
>
>
>.
>