This is not available in earlier browsers. Therefore:
Var JS = function (){
// Sleepless nights
// Bravfing@126.com
// 2011.8.19
Var _ toStr = function (obj ){
Var type = Object. prototype. toString. call (obj). slice (8,-1), rs;
// If it is an html node (not completely judged, it can be forged)
If (obj. nodeType! = Null ){
Return "HTMLNODE"
}
Switch (type ){
Case "Undefined ":
Case "Null ":
Case "Number ":
Case "Boolean ":
Case "Date ":
Case "Function ":
Case "Error ":
Case "RegExp": rs = obj; break;
Case "String": rs = '"' + obj + '"'; break;
Case "Array ":
Rs = "";
For (var I = 0, len = obj. length; I <len; I ++ ){
Rs + = _ toStr (obj [I]) + ",";
}
Rs = "[" + rs. slice (0,-1) + "]";
Break;
Case "Object ":
Rs = [];
For (var k in obj ){
Rs. push ('"' + k. toString () + '":' + _ toStr (obj [k]);
}
Rs = "{" + rs. join (",") + "}";
Break;
}
Return rs;
};
Return {"toStr": _ toStr };
}();
Debugging in ie is very convenient.