[英]How do I identify Sys.UI._Timer in my JavaScript?
在我的網頁源代碼中,我有:
Sys.Application.add_init(function() {
$create(Sys.UI._Timer, {"enabled":true,"interval":300000,"uniqueID":"timerMain"}, null, null, $get("timerMain"));
});
什么是 Sys.UI._Timer ? 它是服務器端的 .Net 類嗎?
Sys.UI._Timer
是一個類似於System.Web.UI.Timer
服務器控件但在客戶端(使用 JS)運行的類,它使用 AJAX 客戶端庫創建計時器控件。 該類的默認構造函數定義如下所示:
Sys.UI._Timer = function Sys$UI$_Timer(element) {
Sys.UI._Timer.initializeBase(this,[element]);
this._interval = 60000; // Interval property, measured in milliseconds
this._enabled = true; // Enabled property
this._uniqueID = null; // UniqueID property
// client-side only properties
this._postbackPending = false;
this._raiseTickDelegate = null;
this._endRequestHandlerDelegate = null;
this._timer = null;
this._pageRequestManager = null;
}
請注意, $create
是Sys.Component.create
靜態方法的簡寫,它創建(並初始化)具有指定類型作為參數的組件(在本例中為Sys.UI._Timer
)。 您要設置到組件屬性中的屬性值必須以 JSON 格式提供,並且屬性名稱的用法不帶下划線(因此_interval
變成只是interval
),使用以下語法:
$create(type, { "propertyName": value, ... }, events, references, $get(elementName));
進一步閱讀:
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.