I prefer not to use the // syntax for creating regular expressions. Use
this instead:
new RegExp ('Jeremy', 'i')
In any case, you don't need a regular expression, try passing the string,
'Jeremy' and I it should work.
----- Original Message -----
From: "Jeremy Coulter" <[EMAIL PROTECTED]>
To: "'NZ Borland Developers Group - Offtopic List'" <[email protected]>
Sent: Friday, October 20, 2006 10:27 AM
Subject: RE: [DUG-Offtopic] Cleaver javascript person/s help needed
Thanks Dennis, I took a look and found a couple of examples, and have it
working TO a point. What I really want to do is, call a function that lets
me pass the regular expression , but not sure hwo to do this. Ok, that’s a
bit broad, what I have done is this :-
*************************************************************
<script type="javascript">
function changeit(svalue)
{
var str=document.form1.msg.value;
document.form1.msg.value = str.replace(svalue, '');
}
</script>
Then on the control I go :-
onclick="changit('/Jeremy/i');"
*************************************************************
This would replace Jeremy with an empty string. But this doesn’t work, and
I
suspect its because of the way I am passing the regular expression.
Can you tell me where I am going wrong?
Thanks Jeremy
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
On Behalf Of Dennis Chuah
Sent: 20 October 2006 06:56
To: [email protected]
Subject: Re: [DUG-Offtopic] Cleaver javascript person/s help needed
2 scenarios:
1. If the textarea is read only (i.e., the user is not able to key in
text), instead of removing the value, why don't the function recalculates
what needs to be in the textarea and replace the whole value.
2. If the textarea is not read-only, use regular expression to find the
text and remove it. Use the replace method in javascript string - look it
up on MSDN online. Depending on your circumstances, you may be able to
get
away with not using regular expressions. The replace method can work with
both regular expressions or simple string replacement.
Dennis.
----- Original Message -----
From: "Jeremy Coulter" <[EMAIL PROTECTED]>
Sent: Thursday, October 19, 2006 9:59 PM
Hi All.
I am Just doing a webbased tool at the moment that I need some javascript
help with.
Basically what I want to do is this :-
Have a series of tick boxes, each with a value assigned to them, say "I
am
a
test"
I want to add this text to a TextArea if its checked.....which I can do
now,
BUT heres the thing, IF I decided to uncheck the tickbox, I need the
value
added, in this case "I am a test" removed from the TextArea.....BTW,
there
would/could be other text in the TextArea that would need to stay there.
Is this hard to do? is it a quick thing to do? can someone assist?
Thanks, Jeremy
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.5/483 - Release Date:
18/10/2006
----------------------------------------------------------------------------
----
_______________________________________________
Offtopic mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/offtopic
_______________________________________________
Offtopic mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/offtopic
--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.5/483 - Release Date: 18/10/2006
--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.7/488 - Release Date: 19/10/2006
_______________________________________________
Offtopic mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/offtopic
_______________________________________________
Offtopic mailing list
[email protected]
http://ns3.123.co.nz/mailman/listinfo/offtopic