Jump to content

cutting this replace code down


pouncer

Recommended Posts

[code]
function EmotReplace(text) {
var newText;

newText = text.replace(":)", '<img src="emoticons/smile.gif">');
newText = newText.replace(":-)", '<img src="emoticons/smile.gif">');

newText = newText.replace(/:O/g, '<img src="emoticons/surprised.gif">');
newText = newText.replace(/:-O/g, '<img src="emoticons/surprised.gif">');

return newText;
}
[/code]

any way i can cut them down? and on the second one i want to display the surprised.gif on all these texts
[code]
:-O
:O
:o
:-o
/code]

so it shud work on lowercase o as well. can someone please help me out[/code]
Link to comment
https://forums.phpfreaks.com/topic/28939-cutting-this-replace-code-down/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.