
jquery 扩展函数:
代码如下:
(function($) {
$.fn.disable = function() {
///
/// 屏蔽所有元素
/// ///
return $(this).find("*").each(function() {
$(this).attr("disabled", "disabled");
});
}
$.fn.enable = function() {
///
/// 使得所有元素都有效
/// ///
return $(this).find("*").each(function() {
$(this).removeAttr("disabled");
});
}
})(jQuery);
script>
使用方式:装载立即屏蔽:
代码如下:
$(document).ready(function() {
$("#div_test").disable();
});
script>
结果不是很美观,但是还是蛮有效。
当然美观的方式是在上面建立一个图层进行屏蔽。