如下代码,为什么第一个函数也能正确运行呢?setInterval()函数为什么能被声明为一个变量呢?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title></title>
<script type="text/javascript">
var n = 0;
function t() {
document.title = n++;
}
var timer = setInterval("t()",1000);
function h() {
document.write(9);
}
setTimeout(h(),1000);
</script>
</head>
<body>
</body>
</html>
添加回答
举报
0/150
提交
取消