zoukankan      html  css  js  c++  java
  • telerik的RadButton客户端操作库 yz

      1 //本 javascript 基于 telerik 的 AJAX ASP.NET 客户端js操作的封装库
      2 //本库为 教育使用
      3 //制定时间: 2013/04/18 9:03
      4 //Debug v 1.0
      5 
      6 // RadButton 的扩展
      7 
      8 function RadButton(id) {
      9     this.obj = $find(id);
     10     if (RadButton.prototype.initialize == undefined) {
     11 
     12         //设置初始化位
     13         RadButton.prototype.initialize == "";
     14 
     15         RadButton.prototype.isFunction = function () {
     16             if (arguments.length == 1 && typeof arguments[0][0] == "function") {
     17                 return 1;
     18             }
     19             return 0;
     20         };
     21 
     22         //设置或移除控件加载时的响应事件程序
     23         RadButton.prototype.load = function (func) {
     24             if (this.isFunction(arguments)) {
     25                 this.obj.add_load(func);
     26             } else {
     27                 this.obj.remove_load();
     28             }
     29             return this;
     30         };
     31 
     32         //设置或移除控件按时的响应事件程序
     33         RadButton.prototype.clicking = function (func) {
     34             if (this.isFunction(arguments)) {
     35                 this.obj.add_clicking(func);
     36             } else {
     37                 this.obj.remove_clicking();
     38             }
     39             return this;
     40         };
     41 
     42         //设置或移除控件按下时的响应事件程序
     43         RadButton.prototype.clicked = function (func) {
     44             if (this.isFunction(arguments)) {
     45                 this.obj.add_clicked(func);
     46             } else {
     47                 this.obj.remove_clicked();
     48             }
     49             return this;
     50         };
     51 
     52         //设置或移除鼠标在控件上移动的响应事件程序
     53         RadButton.prototype.mouseOver = function (func) {
     54             if (this.isFunction(arguments)) {
     55                 this.obj.add_mouseOver(func);
     56             } else {
     57                 this.obj.remove_mouseOver();
     58             }
     59             return this;
     60         };
     61 
     62         //设置或移除鼠标离开控件的响应事件程序
     63         RadButton.prototype.mouseOut = function (func) {
     64             if (this.isFunction(arguments)) {
     65                 this.obj.add_mouseOut(func);
     66             } else {
     67                 this.obj.remove_mouseOut();
     68             }
     69             return this;
     70         };
     71 
     72         //设置或移除控件的checked属性改变时的响应程序
     73         RadButton.prototype.checkChanging = function (func) {
     74             if (this.isFunction(arguments)) {
     75                 this.obj.add_checkedChanging(func);
     76             } else {
     77                 this.obj.remove_checkedChanging();
     78             }
     79             return this;
     80         };
     81 
     82         //设置或移除控件的checked属性在改变后的响应程序
     83         RadButton.prototype.checkChanged = function (func) {
     84             if (this.isFunction(arguments)) {
     85                 this.obj.add_checkedChanged(func);
     86             } else {
     87                 this.obj.remove_checkedChainged();
     88             }
     89             return this;
     90         };
     91 
     92         //设置或移除控件的 SelectedToggleStateIndex 属性改变时的响应程序
     93         RadButton.prototype.toggleStateChanging = function (func) {
     94             if (this.isFunction(arguments)) {
     95                 this.obj.add_toggleStateChanging(func);
     96             } else {
     97                 this.obj.remove_toggleStateChanging();
     98             }
     99             return this;
    100         };
    101 
    102         //设置或移除控件的 SelectedToggleStateIndex 属性在改变后的响应程序
    103         RadButton.prototype.toggleStateChanged = function (func) {
    104             if (this.isFunction(arguments)) {
    105                 this.obj.add_toggleStateChanged(func);
    106             } else {
    107                 this.obj.remove_toggleStateChanged();
    108             }
    109             return this;
    110         };
    111 
    112         //清楚单选按钮组的选中状态
    113         //groupname : GroupName 名称
    114         RadButton.prototype.clearCheckedRadios = function (groupname) {
    115             this.obj.clearCheckedRadios(groupname);
    116             return this;
    117         };
    118 
    119         //让控件获得焦点
    120         RadButton.prototype.focus = function () {
    121             this.obj.focus();
    122             return this;
    123         };
    124 
    125         //点击控件
    126         RadButton.prototype.click = function (option) {
    127             this.obj.click(option);
    128             return this;
    129         };
    130 
    131         //设置控件是否可用
    132         //获得空间当前状态
    133         RadButton.prototype.enabled = function (option) {
    134             if (arguments.length == 0) {
    135                 return this.obj.get_enabled();
    136             } else if (typeof option == "boolean") {
    137                 this.obj.set_enabled(option);
    138                 return this;
    139             }
    140             return this;
    141         };
    142 
    143         //设置控件为只读
    144         //获得控件的只读状态
    145         RadButton.prototype.readOnly = function (option) {
    146             if (arguments.length == 0) {
    147                 return this.obj.get_readOnly();
    148             } else if (typeof option == "boolean") {
    149                 this.obj.set_readOnly(option);
    150                 return this;
    151             }
    152             return this;
    153         };
    154 
    155         //设置控件的文本内容
    156         //获得控件的文本内容
    157         RadButton.prototype.text = function (option) {
    158             if (arguments.length == 0) {
    159                 return this.obj.get_text();
    160             } else if (typeof option == "string") {
    161                 this.obj.set_text(option);
    162                 return this;
    163             }
    164             return this;
    165         };
    166 
    167         //设置控件的提示
    168         //获得控件的提示
    169         RadButton.prototype.toolTip = function (option) {
    170             if (arguments.length == 0) {
    171                 return this.obj.get_toolTip();
    172             } else if (typeof option == "string") {
    173                 this.obj.set_toolTip(option);
    174                 return this;
    175             }
    176             return this;
    177         };
    178 
    179         //获得控件的唯一ID
    180         RadButton.prototype.uniqueID = function () {
    181             return this.obj.get_uniqueID();
    182         };
    183 
    184         //获得控件的选中状态
    185         //设置控件的选中状态
    186         RadButton.prototype.checked = function (option) {
    187             if (arguments.length == 0) {
    188                 return this.obj.get_checked();
    189             } else if (typeof arguments[0] == "boolean") {
    190                 this.obj.set_checked(option);
    191                 return this;
    192             }
    193             return this;
    194         };
    195 
    196         //获得控件的类型
    197         RadButton.prototype.buttonType = function () {
    198             return this.obj.get_buttonType();
    199         };
    200 
    201         //获得控件的转换类型
    202         RadButton.prototype.toggleType = function () {
    203             return this.obj.get_toggleType();
    204         };
    205 
    206         //设置/获得控件的跳转方式
    207         RadButton.prototype.target = function (option) {
    208             if (arguments.length == 0) {
    209                 return this.obj.get_target();
    210             } else if (typeof arguments[0] == "string") {
    211                 this.obj.set_target(option);
    212                 return this;
    213             }
    214             return this;
    215         };
    216 
    217         //设置/获得控件的跳转链接
    218         RadButton.prototype.navigateUrl = function (option) {
    219             if (arguments.length == 0) {
    220                 return this.obj.get_navigateUrl();
    221             } else if (typeof arguments[0] == "string") {
    222                 this.obj.set_navigateUrl(option);
    223                 return this;
    224             }
    225             return this;
    226         };
    227 
    228         //获得前置图标的HTML对象引用
    229         RadButton.prototype.primaryIconElement = function () {
    230             return this.obj.get_primaryIconElement();
    231         };
    232 
    233         //获得后置图标的HTML对象引用
    234         RadButton.prototype.secondaryIconElement = function () {
    235             return this.obj.get_secondaryIconElement();
    236         };
    237 
    238         //获得文本的HTML对象引用
    239         RadButton.prototype.textElement = function () {
    240             return this.obj.get_textElement();
    241         };
    242 
    243         //获得控件在客户端的样式类名
    244         RadButton.prototype.cssClass = function () {
    245             return this.obj.get_cssClass();
    246         };
    247 
    248         //获得控件在客户端的禁用状态下的样式类名
    249         RadButton.prototype.disabledCssClass = function () {
    250             return this.obj.get_disabledCssClass();
    251         };
    252 
    253         //获得鼠标在控件上时的样式类名
    254         RadButton.prototype.hoveredCssClass = function () {
    255             return this.obj.get_hoveredCssClass();
    256         };
    257 
    258         //获得控件点击后的样式类名
    259         RadButton.prototype.pressedCssClass = function () {
    260             return this.obj.get_pressedCssClass();
    261         };
    262 
    263         //获得/设置命令名称
    264         RadButton.prototype.commandName = function (option) {
    265             if (arguments.length == 0) {
    266                 return this.obj.get_commandName();
    267             } else if (typeof option == "string") {
    268                 this.obj.set_commandName(option);
    269                 return this;
    270             }
    271             return this;
    272         };
    273 
    274         //获得/设置命令参数
    275         RadButton.prototype.commandArgument = function (option) {
    276             if (arguments.length == 0) {
    277                 return this.obj.get_commandArgument();
    278             } else if (typeof arguments[0] == "string") {
    279                 this.obj.set_commandArgument(option);
    280                 return this;
    281             }
    282             return this;
    283         };
    284 
    285         //获得/设置自动回传属性
    286         RadButton.prototype.autoPostBack = function (option) {
    287             if (arguments.length == 0) {
    288                 return this.obj.get_autoPostBack();
    289             } else if (typeof arguments[0] == "boolean") {
    290                 this.obj.set_autoPostBack(option);
    291                 return this;
    292             }
    293             return this;
    294         };
    295 
    296         //获得/设置控件的分组名称
    297         RadButton.prototype.groupName = function (option) {
    298             if (arguments.length == 0) {
    299                 return this.obj.get_groupName();
    300             } else if (typeof arguments[0] == "string") {
    301                 this.obj.set_groupName();
    302                 return this;
    303             }
    304             return this;
    305         };
    306 
    307         //获得/设置控件的高度
    308         RadButton.prototype.height = function (num) {
    309             if (arguments.length == 0) {
    310                 return this.obj.get_height();
    311             } else if (typeof arguments[0] == "number") {
    312                 this.obj.set_height(num);
    313                 return this;
    314             }
    315             return this;
    316         };
    317 
    318         //获得/设置控件的宽度
    319         RadButton.prototype.width = function (num) {
    320             if (arguments.length == 0) {
    321                 return this.obj.get_width();
    322             } else if (typeof arguments[0] == "number") {
    323                 this.obj.set_width(num);
    324                 return this;
    325             }
    326             return this;
    327         };
    328 
    329         //获得/设置控件的下拉属性
    330         RadButton.prototype.enabledSplitButton = function (option) {
    331             if (arguments.length == 0) {
    332                 return this.obj.get_enabledSplitButton();
    333             } else if (typeof arguments[0] == "boolean") {
    334                 this.obj.set_enabledSplitButton(option);
    335                 return this;
    336             }
    337             return this;
    338         };
    339 
    340         //当前按钮是否为图片按钮
    341         RadButton.prototype.isImageButton = function () {
    342             return this.obj.IsImageButton();
    343         };
    344 
    345         //当前按钮是否为提交按钮
    346         RadButton.prototype.isInputTypeSubmit = function () {
    347             return this.obj.IsInputTypeSubmit();
    348         };
    349 
    350         //获得当前按钮是否为延迟按钮
    351         //设置当前按钮为延迟按钮
    352         RadButton.prototype.singleClick = function (option) {
    353             if (arguments.length == 0) {
    354                 return this.obj.get_singleClick();
    355             } else if (typeof arguments[0] == "boolean") {
    356                 this.obj.set_singleClick(option);
    357                 return this;
    358             }
    359             return this;
    360         };
    361 
    362         //获得/设置延迟按钮显示的文本
    363         RadButton.prototype.singleClickText = function (option) {
    364             if (arguments.length == 0) {
    365                 return this.obj.get_singleClickText();
    366             } else if (typeof arguments[0] == "string") {
    367                 this.obj.set_singleClickText(option);
    368                 return this;
    369             }
    370             return this;
    371         };
    372 
    373         //让按钮从设置延迟加载后的状态恢复为正常状态
    374         RadButton.prototype.enableAfterSingleClick = function (option) {
    375             this.obj.enableAfterSingleClick();
    376             return this;
    377         };
    378 
    379         //获得/设置控件的显示状态
    380         RadButton.prototype.visible = function (option) {
    381             if (arguments.length == 0) {
    382                 return this.obj.get_visible();
    383             } else if (typeof arguments[0] == "boolean") {
    384                 this.obj.set_visible(option);
    385                 return this;
    386             }
    387             return this;
    388         };
    389 
    390         //获得/设置控件的验证组名称
    391         RadButton.prototype.validationGroup = function (option) {
    392             if (arguments.length == 0) {
    393                 return this.obj.get_validationGroup();
    394             } else if (typeof arguments[0] == "string") {
    395                 this.obj.set_validationGroup(option);
    396                 return this;
    397             }
    398             return this;
    399         };
    400 
    401         //说的当前所选 toggle 的value
    402         RadButton.prototype.selectedValue = function () {
    403             return this.obj.get_selectedToggleState().get_value();
    404         };
    405 
    406         //获得/设置当前所选 toggle 的索引
    407         RadButton.prototype.selectedIndex = function (option) {
    408             if (arguments.length == 0) {
    409                 return this.obj.get_selectedToggleState().get_index();
    410             } else if (typeof arguments[0] == "number") {
    411                 this.obj.set_selectedToggleStateIndex(option);
    412                 return this;
    413             }
    414             return this;
    415         };
    416 
    417         //获得当前所选 toggle 的文本
    418         RadButton.prototype.selectedText = function () {
    419             return this.obj.get_selectedToggleState().get_text();
    420         };
    421     }
    422 }
    423 
    424 // RadButton 扩展结束
    425 
    426 // 
  • 相关阅读:
    vim命令总结
    SQL语句中----删除表数据drop、truncate和delete的用法
    备份数据工具类
    JavaWeb之 JSP:自定义标签
    Android studio安装与配置
    Redis 从入门到放弃
    java相关网址汇总2
    java相关网址汇总1
    校验字符串编码工具类
    java相关网址汇总(myself)
  • 原文地址:https://www.cnblogs.com/yaozhenfa/p/3027856.html
Copyright © 2011-2022 走看看