请求写一个正确的用于ASP。NET AJAX1.0的JAVASCRIT脚本文件
我在学习《使用ASP.NET Atlas编写显示真实进度的ProgressBar(进度条)控件》(原文是:http://dflying.cnblogs.com/archive/2006/03/28/361146.html),觉得很不错,解决了.NET进度条的问题,但是当我用ASP。NET AJAX1.0来做,复制了示例代码,发现一个问题,就是它的示例代码是用于ASP.NET Atlas,如果我用的是ASP。NET AJAX1.0,它的脚本文件写法就不一样,是新的.NET框架的JAVASCRIT脚本扩展语法,恳请高手帮我修改一下:源代码如下:
Sys.UI.ProgressBar = function(associatedElement) {
Sys.UI.ProgressBar.initializeBase(this, [associatedElement]);
var _timer = new Sys.Timer();
var _progress = 0;
var _serviceURL;
var _serviceMethod;
var _responsePending;
var _tickHandler;
var _obj = this;
this.get_progress = function() {
return _progress;
}
this.set_progress = function(value) {
if (value >= 100) {
_timer.set_enabled(false);
}
_progress = value;
associatedElement.style.width = value + "%";
associatedElement.innerHTML = value == 100 ? "Done!" : value + "%";
}
this.get_interval = function() {
return _timer.get_interval();
}
this.set_interval = function(value) {
_timer.set_interval(value);
}
this.get_serviceURL = function() {
return _serviceURL;
}
this.set_serviceURL = function(value) {
_serviceURL = value;
}
this.get_serviceMethod = function() {
return _serviceMethod;
}
this.set_serviceMethod = function(value) {
_serviceMethod = value;
}
this.getDescriptor = function() {
var td = Sys.UI.ProgressBar.callBaseMethod(this, 'getDescriptor');
td.addProperty('interval', Number);
td.addProperty('progress', Number);
td.addProperty('serviceURL', String);
td.addProperty('serviceMethod', String);
td.addMethod('start');
td.addMethod('stop');
return des;
}
this.initialize = function() {
Sys.UI.ProgressBar.callBaseMethod(this, 'initialize');
_tickHandler = Function.createDelegate(this, this._onTimerTick);
_timer.tick.add(_tickHandler);
this.set_progress(0);
}
this.dispose = function() {
if (_timer) {
_timer.tick.remove(_tickHandler);
_tickHandler = null;
_timer.dispose();
}
_timer = null;
associatedElement = null;
_obj = null;
Sys.UI.ProgressBar.callBaseMethod(this, 'dispose');
}
this.start = function() {
_timer.set_enabled(true);
}
this.stop = function() {
_timer.set_enabled(false);
}
this._onTimerTick = function(sender, eventArgs) {
if (!_responsePending) {
_responsePending = true;
// Asynchronously call the service method.
Sys.Net.ServiceMethod.invoke(_serviceURL, _serviceMethod, null, null, _onMethodComplete);
}
}
function _onMethodComplete(result) {
// Update the progress bar.
_obj.set_progress(result);
_responsePending = false;
}
}
Type.registerSealedClass('Sys.UI.ProgressBar', Sys.UI.Control);
Sys.TypeDescriptor.addType('script','progressBar', Sys.UI.ProgressBar); --------------------编程问答-------------------- 版主,请求帮忙!!!! --------------------编程问答-------------------- 怎么没人会呢??? --------------------编程问答-------------------- 学习 --------------------编程问答-------------------- 有人帮忙解决吗??? --------------------编程问答-------------------- 有人帮忙解决吗??? --------------------编程问答-------------------- 有人帮忙解决吗??? --------------------编程问答-------------------- 如果你JavaScript基础没问题的话,先读读ASP.NET AJAX的JavaScript,模仿RTM的样子将Dflying的CTP版本改为正式版,这应该不难。 --------------------编程问答-------------------- 已经模仿了,但就是调试这个JS文件出错,可否请高手大力支持一下 --------------------编程问答-------------------- 有人帮忙解决吗???
补充:.NET技术 , ASP.NET