<html>
<head>
<body>
<div id ="main">
</body>
</head>
</html>
<script type="text/javascript">
var obj = document.getElementById("main");
debugger;
obj.style.border="1px solid red";
setTimeout(function(){obj.style.display='none';},1000);
function delayedAlert(msg,time){
setTimeout(function(){alert(msg);},time);
}
delayedAlert("welcome", 2000);
//bi bao
function addGen(num){
return function(toAdd){
return num+toAdd;};
}
var addFive = addGen(5);
alert(addFive(4)==9);
//匿名闭包
(function {
var msg = "test";
window.οnlοad=function(){
alert(msg);};
//关闭匿名闭包并执行
})();
</script>