<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<script type="text/javascript">
子函数可以使用父函数中的局部变量叫闭包。
闭包就是两个函数嵌套。
将内部嵌套的函数return。
<script type="text/javascript">
function f1(){
function f2(){
console.log
函数内部变量只能在本函数使用,它的子函数可以使用,但是它的函数体里面调用了其它的函数不能使用。
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8&quo
window.onload=function(){
var stop=document.getElementById("stop");
dt=setInterval("showtime()",1000);
stop.addEventListener("click",function(){
clearInterval(dt);
});
}
正常运行:
<meta http-equiv="Content-Type" content="text/html;chars
js window是根节点,document属于window
document.getElementById("");//文档操作,DOM,完整是 window.document.getElementById
window.location.href="";//这个就属于window操作 BOM