对象调用

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Untitled Document</title>
	</head>
	<body>
		<script type='text/javascript'>
			
			var a=function(){
				document.write(this instanceof a);
				document.write("<br>");
				document.write(this.constructor	);
				document.write("<br>");
				document.write("<br>");
				document.write("<br>");
			}
			
			
			a();
			var aa=new a();
			
			
		</script>
	</body>
</html>


那么下面的呢?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
		<title>Untitled Document</title>
	</head>
	<body>
		<script type='text/javascript'>
			
			var a=function(){
				document.write(this instanceof a);
				document.write("<br>");
				document.write(this.constructor	);
				document.write("<br>");
				document.write("<br>");
				document.write("<br>");
			}
			
			a.prototype.constructor=function(){
			   	alert(this);
				return this;
			}()
			a.constructor=function(){
				alert("call?");
			}
			
			a();
			var aa=new a();
			
			
		</script>
	</body>
</html>


你可能感兴趣的:(html,prototype)