Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Liệt kê 7-38: Một Trang Sử dụng phiên bản mới của Class Monitor Chưa có tiêu đề var theo dõi chức năng disposingcb () {alert ("Sự kiện xử lý được nâng lên!");} Chức năng propertyChangedcb (người gửi, e) { | Chapter 7 Component Development Infrastructure You must always include this script at the end of JavaScript files that contain the required scripts for your ASP.NET AJAX application. As you can see this script invokes the notifyScriptLoaded method on the current Application object to notify the object that the loading of the current JavaScript file is completed. Listing 7-38 presents a page that uses the new version of the Monitor class. Listing 7-38 A Page that Uses the New Version of the Monitor Class @ Page Language C DOCTYPE html PUBLIC - W3C DTD XHTML 1.0 Transitional EN http www.w3.org TR xhtml1 DTD xhtml1-transitional.dtd html xmlns http www.w3.org 1999 xhtml head id Head1 runat server title Untitled Page title script type text javascript language javascript var monitor function disposingcb alert The Disposing event was raised function propertyChangedcb sender e alert e.get_propertyName property changed function changeFontSize domEvent var fontsizetxt get fontsizetxt monitor.set_fontsize fontsizetxt.value function changeld domEvent var id get id try monitor.set_id id.value catch ex alert ex.message continued 275 Chapter 7 Component Development Infrastructure Listing 7-38 continued function pageLoad var type CustomComponents.Monitor var properties id Monitorl var events disposing disposingcb propertyChanged propertyChangedcb var references null var element null monitor create type properties events references element var changeldbtn get changeIdbtn addHandler changeIdbtn click changeld var changeFontSizebtn get changeFontSizebtn addHandler changeFontSizebtn click changeFontSize script head body form id form1 runat server asp ScriptManager ID ScriptManager1 runat server Scripts asp ScriptReference Path Monitor.js Scripts asp ScriptManager Enter new Monitor id input type text id id nbsp button id changeIdbtn type button Change Id button br br Enter new font size input type text id fontSizetxt nbsp button id changeFontSizebtn type button Change Font Size button