I have something like in java
stringBuffer.append("<a onclick=\"javascript:setPName('"+StringEscapeUtils.escapeJavaScript(tmpResult)+"');\"><small> "+StringEscapeUtils.escapeJavaScript(tmpResult)+"</small></a>");
While checking the same on Console of Firebug it comes correctly. But I get the following when I check from IE developer tools:
<A onclick="javascript:setPName('TEST\" AKHIL?);?><SMALL>TEST\"AKHIL</SMALL></A>
Problem is that browser is not still recognizing it. I had used StringEscapeUtils.escapeJavaScript to escape single quotes but it does not work for double quotes.