-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSkills.html
43 lines (41 loc) · 1.32 KB
/
Skills.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<html>
//include:prototype/__proto__/userAgent
//prototype.url:http://www.cnblogs.com/zzcflying/archive/2012/07/20/2601112.html
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>test</title>
<script type="text/javascript">
function People(name)
{
this.name=name;
//对象方法
this.Introduce=function(){
alert("My name is "+this.name);
}
}
//类方法
People.Run=function(){
alert("I can run");
}
//原型方法2。3
People.prototype.IntroduceChinese=function(){
alert("我的名字是"+this.name);
}
function calick(){
//alert(1);
var p1=new People("Windking");
//p1.Introduce();
//People.Run();
p1.IntroduceChinese();
//首先var p=new People();可以得出p.__proto__=People.prototype。那么当我们调用p1.IntroduceChinese()时,首先p1中没有IntroduceChinese这个属性,于是,他就需要到他的__proto__中去找,也就是People.IntroduceChinese,而我们在上面定义了People.prototype.IntroduceChinese=function(){}; 于是,就找到了这个方法。
}
function info(){
document.write("<p>UserAgent: ")//userAgent 浏览器信息
document.write(navigator.userAgent + "</p>")
}
</script>
</head>
<body>
<input id="test" name="test" type="button" onclick="calick();" />
</body>
</html>