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' }, { text:':rock:', image: '3.png' } ]; for ( var i = 0; i < emoticons.length; i++ ){ inputStr = inputStr.split(emoticons[i].text).join(''); } return inputStr; }