View Single Post
  #2 (permalink)  
Old June 14th, 2005, 06:34 AM
ChrisScott ChrisScott is offline
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi interrupt,

You can use a RegExp with replace() & then set it tp apply globally with the g flag, try this:
Code:
var myStr = ":\)some:\)other:\)text";
alert(myStr.replace(/:\)/g, "<img src =\"grin.gif\">"));
HTH,

Chris

Reply With Quote