?? 對象的方法.txt
字號:
對象的方法:對象自己的函數
<html>
<title>Please see my computer</title>
<head>
<script language="Javascript">
function computer(brand,year,owner)
{
this.brand=brand;
this.year=year;
this.owner=owner;
}
function Show(obj)
{
document.writeln(obj.brand+"<BR>");
document.writeln(obj.year+"<BR>");
document.writeln(obj.owner);
}
</script>
</head>
<body>
<script language=javascript>
var MyComputer=new computer("IBM",1996,"Liu");//申明對象并初始化
MyComputer.CompShow=Show;//聯系方法
MyComputer.CompShow(MyComputer);//調用方法
</script>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -