eval('for(var p in '+objName+') result+=(objName+"."+p+"="+'+objName+'[p]+"\\n")');
在换行符加个'\'就可以了...