Click here to Skip to main content
15,884,237 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello..

replace is not working in IE7. i m getting "Microsoft JScript runtime error: Object doesn't support property or method 'replace'" when debug the javascript for IE7.

eg.
JavaScript
s = s.replace(/\'/g,"'");


Please suggest how to use replace in IE7.

Please help ASAP.

Thanks in Advance.
Posted
Updated 26-Dec-13 0:57am
v2
Comments
Peter Leow 25-Dec-13 1:50am    
Look like you are trying to replace some string with empty string, can you show more code?
niralirshah 25-Dec-13 2:02am    
thank you..
actually i want to encode the input html in javascript for XSS and SQL Injection for ASP website. for this i am using replace method for the same.


function(s,en){
if(!this.isEmpty(s)){
en = en || true;
// do we convert to numerical or html entity?
if(en){
s = s.replace(/\'/g,"'");
s = s.replace(/\"/g,""");
s = s.replace(//g,">");
}else{
s = s.replace(/\'/g,"'");
s = s.replace(/\"/g,""");
s = s.replace(//g,">");
}
return s;

please help me ...
thanks for your help..
Sunasara Imdadhusen 26-Dec-13 6:56am    
Do not post your answer in comment box please use Answer box!
Sergey Alexandrovich Kryukov 25-Dec-13 2:24am    
It depends on what was "s"...
—SA
niralirshah 25-Dec-13 2:39am    
assume s=<abcd and="" want="" to="" replace=""><abcd with="" grtabcd..=""></abcd>

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900