<%--進階JavaScript<1>物件方法屬性操作--%>
<script type="text/javascript">
//委派Function?!
function say(msg) { alert(this.Name + ' 說:' + msg); }//建立物件
var person = new Object();
person.Name = "Sam";
person.say = say;//取得屬性與呼叫方法
alert("Name = " + person.Name);
person.say("Hello !");//透過名稱字串呼叫方法與取得屬性
alert("Name = " + person["Name"]);
person["say"]("Hello !");
</script>
<%--進階JavaScript<2>匿名方法--%>
<script type="text/javascript">
//建立物件
var person = new Object();
person.Name = "Peggy";
//匿名方法設定方法
person.say = function(msg) { alert(this.Name + ' 說:' + msg) };//取得屬性與呼叫方法
alert("Name = " + person.Name);
person.say("匿名方法耶 !");//透過名稱字串呼叫方法與取得屬性
alert("Name = " + person["Name"]);
person["say"]("匿名方法耶 !");
</script><%--進階JavaScript<3>匿名物件--%>
<script type="text/javascript">
//建立匿名物件
var person = {
Name: "Peggy and Sam",
say: function(msg) { alert(this.Name + ' 說:' + msg); }
};//取得屬性與呼叫方法
alert("Name = " + person.Name);
person.say("匿名物件耶 !");//透過名稱字串呼叫方法與取得屬性
alert("Name = " + person["Name"]);
person["say"]("匿名物件耶 !");
</script>
網誌標籤
.NET Framework
(5)
文字編碼
(4)
防毒軟體
(1)
其他
(11)
資料庫
(25)
攝影
(2)
ADO.NET Entity Framework
(2)
ASP.NET
(49)
ASP.NET MVC
(4)
ASP.NET Test
(4)
CSS
(1)
Design Patten
(1)
FCKEditor
(3)
HTML
(2)
HTML5
(1)
hyper-v
(1)
IIS
(6)
JavaScript
(9)
JQuery
(1)
LINQ
(2)
MailTo編碼
(2)
oracle
(6)
RegularExpression
(1)
Rhino Mocks
(1)
Security
(2)
Server2008R2
(1)
SharePoint
(5)
Sql 2008
(1)
SSIS
(1)
SyntaxHighlighter
(1)
TFS2010
(1)
VirtualBox
(1)
VistualStudio2010
(3)
vs2003升級vs2008
(1)
windows
(1)
windows 7
(1)
JavaScript進階技巧
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言