Type.registerNamespace("Demo"); //怎样看这个类Type的代码// Constructor
Demo.HoverButton = function(element) { Demo.HoverButton.initializeBase(this, [element]); this._clickDelegate = null;
this._hoverDelegate = null;
this._unhoverDelegate = null;
}
Demo.HoverButton.prototype = { // text property accessors.
get_text: function() {
return this.get_element().innerHTML; //首先是这里 this.get_element() 在哪里定义 是继承来的吗 如果是继承来的 怎样能看到它的定义
},
set_text: function(value) {
this.get_element().innerHTML = value;
}, // Bind and unbind to click event.
add_click: function(handler) {
this.get_events().addHandler('click', handler);
},
remove_click: function(handler) {
this.get_events().removeHandler('click', handler);
}, // Bind and unbind to hover event.
add_hover: function(handler) {
this.get_events().addHandler('hover', handler);
},
remove_hover: function(handler) {
this.get_events().removeHandler('hover', handler);
}, // Bind and unbind to unhover event.
add_unhover: function(handler) {
this.get_events().addHandler('unhover', handler);
},
remove_unhover: function(handler) {
this.get_events().removeHandler('unhover', handler);
}, // Release resources before control is disposed.
dispose: function() { var element = this.get_element(); //这里??? if (this._clickDelegate) {
Sys.UI.DomEvent.removeHandler(element, 'click', this._clickDelegate);
delete this._clickDelegate;
} if (this._hoverDelegate) {
Sys.UI.DomEvent.removeHandler(element, 'focus', this._hoverDelegate);
Sys.UI.DomEvent.removeHandler(element, 'mouseover', this._hoverDelegate);
delete this._hoverDelegate;
} if (this._unhoverDelegate) {
Sys.UI.DomEvent.removeHandler(element, 'blur', this._unhoverDelegate);
Sys.UI.DomEvent.removeHandler(element, 'mouseout', this._unhoverDelegate);
delete this._unhoverDelegate;
}
Demo.HoverButton.callBaseMethod(this, 'dispose');
}, initialize: function() { var element = this.get_element(); if (!element.tabIndex) element.tabIndex = 0; if (this._clickDelegate === null) {
this._clickDelegate = Function.createDelegate(this, this._clickHandler);
}
Sys.UI.DomEvent.addHandler(element, 'click', this._clickDelegate); if (this._hoverDelegate === null) {
this._hoverDelegate = Function.createDelegate(this, this._hoverHandler);
}
Sys.UI.DomEvent.addHandler(element, 'mouseover', this._hoverDelegate);
Sys.UI.DomEvent.addHandler(element, 'focus', this._hoverDelegate); if (this._unhoverDelegate === null) {
this._unhoverDelegate = Function.createDelegate(this, this._unhoverHandler);
}
Sys.UI.DomEvent.addHandler(element, 'mouseout', this._unhoverDelegate);
Sys.UI.DomEvent.addHandler(element, 'blur', this._unhoverDelegate); Demo.HoverButton.callBaseMethod(this, 'initialize'); },
_clickHandler: function(event) {
var h = this.get_events().getHandler('click');
if (h) h(this, Sys.EventArgs.Empty);
},
_hoverHandler: function(event) {
var h = this.get_events().getHandler('hover');
if (h) h(this, Sys.EventArgs.Empty);
},
_unhoverHandler: function(event) {
var h = this.get_events().getHandler('unhover');
if (h) h(this, Sys.EventArgs.Empty);
}
}
Demo.HoverButton.registerClass('Demo.HoverButton', Sys.UI.Control); //这里是继承吧 sys.UI.Control 从哪来的 // Since this script is not loaded by System.Web.Handlers.ScriptResourceHandler
// invoke Sys.Application.notifyScriptLoaded to notify ScriptManager
// that this is the end of the script.
if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
总之希望大家能解释的越详细越好 如果忙的话 推荐小弟两本看完就能理解上面的书 谢谢各位了
解决方案 »
- 如何在已经做好的网页加后台C#代码?
- 内部连接致命错误
- WSS 3.0应用程序模板的安装和卸载的问题,急!!!
- VS2005
- XML高手进来看啊!100分相送!
- 请教高手:如何实现-连动下拉表(用C#写)
- 求,分布式开发文档结构图或部署方案,不要具体的,比较急,明天和别人谈项目;谢谢!!!在线等!!
- 网页上的IMAGE控件不能动态改变已经重新上传的图片,这是怎么回事儿呀,高手教我!
- 想做一个专为DataGrid分页的控件,请大家来指点一下,在线等
- 这个求和的sq;怎么写?
- GridView中的input(text)数据绑定与数据回传,头大了!!
- 将asp.net MVC部署到Win7系统的IIS7上遇到问题了,求高手来看一下。
AJAX 客户端脚本也许要好些