日期:2014-05-16  浏览次数:20340 次

js中遇到的错误1

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>index</title>
		<script src="test1.js"></script>
	</head>
	<body>
		hello
	</body>
</html>
?
var a = new Object();
a.fun = function(){
	//console.log("a");
	alert("a");
}

? ? 在调试中发现一直不执行alert语句,其实这是正常的,当把function和对象a关联的时候,从来没说要调用a的fun方法啊。不要搞混了。