|
Posted by Darko on 11/02/07 18:40
On Nov 2, 5:35 pm, "Silvertype" <roger...@singnet.com.sg> wrote:
> Hi guys,
>
> I have these html tags:
>
> <input type="text" id="txtName" name="txtName" />
>
> <textarea id="taHello" name="taHello">hello world</textarea>
>
> which I want to replace with the following tags:
>
> <input type="text" id="txtName" name="txtName" onClick="setName()" />
>
> <textarea id="taHello" name="taHello" onClick="setName()">hello
> world</textarea>
>
> I know that it can be done by using preg_replace but I haven't really
> figured out how to use it. Any help would be greatly appreciated. Thanks in
> advance.
Hmm... are you trying to say that you want to add the same event
handler to all inputs and textareas, or this event handler depends on
the tag and its contents, and it's not only inputs and textareas?
Anyway, you should read about regular expressions (google search will
give you A LOT of information about them - <a href="http://
www.google.com/search?q=regular+expressions&ie=utf-8&oe=utf-8&rls=org.mozilla:en-US:official&client=firefox-a">google
search about regular expressions</a>), and php.net about preg_replace
(http://www.php.net/preg_replace). That's all you need.
Cheers
Navigation:
[Reply to this message]
|