rarebit Posted October 11, 2008 Share Posted October 11, 2008 I can't seem to output the & sign to generate html escape ':' ... s = s.replace(/::/g, '::'); I've tried along these lines and others: s = s.replace(/::/g, String.fromCharCode(38)+'#58;'); Edit reason: no amps Link to comment https://forums.phpfreaks.com/topic/128009-solved-html-ascii/ Share on other sites More sharing options...
Psycho Posted October 11, 2008 Share Posted October 11, 2008 Your codes are wrong. & is the ampersign : is the colon This '::' will result in this: '::' I think you want this: s = s.replace(/::/g, '::'); Link to comment https://forums.phpfreaks.com/topic/128009-solved-html-ascii/#findComment-662851 Share on other sites More sharing options...
rarebit Posted October 11, 2008 Author Share Posted October 11, 2008 no, I've solved it with: s = s.replace(/&/g, escape('&')+'amp;'); p.s. preview your code, I think it's not what you intended... cheers though... Link to comment https://forums.phpfreaks.com/topic/128009-solved-html-ascii/#findComment-662859 Share on other sites More sharing options...
Psycho Posted October 11, 2008 Share Posted October 11, 2008 p.s. preview your code, I think it's not what you intended... cheers though... LOL, the escape codes were parsed by the forum. I would have thought that would be handled - especially within code tags. Link to comment https://forums.phpfreaks.com/topic/128009-solved-html-ascii/#findComment-662934 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.