I am doing some logic to a string and everything workes fine in Firefox. Found error in IE开发者_运维技巧 but confused to fix it.
var txt=[], regg=/<\/?[^>]+>/gi, ost=str.replace(regg,'').substr(0,l), g=j=0;
var match = null;
while(match = regg.exec( str )){
var f = (regg.lastIndex-match.index);
txt.push([match[0], match.index, regg.lastIndex, f]);
}
In the above code if I call regg.exec( str )
before while then then working in IE. But don't understand why to call.
Also observed that ost=str.replace(regg,'').substr(0,l)
is not accepting for IE.
Guys, Please help.
Thanks in advance.
In this line
ost=str.replace(regg,'').substr(0,l)
the 'l' char is not a number, but a text character. Replace it with a number you need.
Also to see javascript errors:
In FF install and open FireBug
In IE go to: Tools-> Internet Options -> Advanced tab -> Browsing section, and uncheck the "Disable script debugging (Internet Explorer)"
dude I thin i got
r u define l; any thing in ur coding,, then leave my anser
ost=str.replace(regg,'').substr(0,l)// u entered
ost=str.replace(regg,'').substr(0,1)// my suggestion
精彩评论