// *javascript 常用小贴士 *
1.如何获取window对象(如果window对象被别人手动更改!)
var windowObj = (new Function("return this"))();
2.遍历对象操作:
<html>
<body>
<script type="text/javascript">
var obj = {
name:"dd",
age:12,
current:new Date(),
inF:function(){return "I am a function!";}
}
var objStr = "";
for(var o in obj){
if(typeof obj[o]!="function"){
objStr += typeof obj[o]+":"+o+"--"+obj[o]+"<br/>";
}else{
objStr += typeof obj[o]+":"+o+"--"+obj[o]()+"<br/>";
}
}
document.write(objStr);
</script>
</body>
</html>