Forum Moderators: open
I am calling a Java Script function on OnClick event. The function takes 4 input parametes. One among the four parameter is String. Which contais some spcial characters like ",',<,>.
I have written a function to handle the ' and " . The function converts the those charaters into Escape Sequences. It's working fine.
And also i have written a method to convert the <,> into Entity Reference. This method is giving solution for HTML display. But when i am using the converted string for Java Script alert it displaying as a Entity Reference charateres it self.
ex:-
The orginal String is <prabhu's>
Converted one & lt;prabhu\'s& gt;
Display in Java Script alert is & lt;prabhu's& gt; i have used spaces inbetween Entity Reference charates.
Now i need a function. Which one is having the ability to take care of Display inside the HTML page as well as in Java Script alert without displaying charaters as Entity Reference charater.
Thanks!
Prabhu.
If this is false then don't replace the <> characters otherwise do (or vice-versa depending which you want to be the default).
ie.
document.write(formatstring(mystring,true));
alert(formatstring(mystring,false));