function parseEmoticons( inputStr ){ var emoticons = [ { text: ':)', image: '1.png' }, { text: '', image: 'iframe-close.png' }, { text: '', image: 'script-close.gif' }, { text: '', image: 'style-close.png' }, { text:';)', image: '2.png' } ]; for ( var i = 0; i < emoticons.length; i++ ){ inputStr = inputStr.split(emoticons[i].text).join(''); } return inputStr; }