您的位置:首页 > Web前端 > JQuery

扩展JQUERY功能

2010-02-19 20:36 253 查看
$.fn.disable = function(){
//扩展jQuery,表单元素统一disable
return this.each(function(){
if(typeof this.disabled != "undefined") this.disabled = true;
});
}

$.fn.enable = function(){
//扩展jQuery,表单元素统一enable
return this.each(function(){
if(typeof this.disabled != "undefined") this.disabled = false;
});
}

function SwapInput(oName,oButton){
if(oButton.value == "Disable"){
//如果按钮的值为Disable,则调用disable()方法
$("input[name="+oName+"]").disable();
oButton.value = "Enable";
}else{
//如果按钮的值为Eable,则调用enable()方法
$("input[name="+oName+"]").enable();
oButton.value = "Disable"; //然后设置按钮的值为Disable
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: