prototype1.4简介_yj
下面的例子用提示框显示0-9。 <script>
function demoTimes(){ var n = 10;
n.times(function(index){ alert(index); });
/*************************** * you could have also used: * (10).times( .... ); ***************************/ }
</script>
<input type=button value="Test Number.times()" onclick="demoTimes()">
让我们看看如何运用这些扩展。
<input type=checkbox id=myChk value=1> Test? <script>
//declaring the class
var CheckboxWatcher = Class.create();
//defining the rest of the class implementation CheckboxWatcher.prototype = {
initialize: function(chkBox, message) { this.chkBox = $(chkBox); this.message = message;
//assigning our method to the event
this.chkBox.onclick =
this.showMessage.bindAsEventListener(this); },
showMessage: function(evt) {
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库prototype1.4简介_yj(14)在线全文阅读。
相关推荐: