一个避免用户重复点击按钮造成重复数据的小技巧
<script>
??????? //启用遮罩
??????? function SetEstopForButton(buttionId) {
??????????? if ($("#btnEstop")[0] == null) {
??????????????? $("#" + buttionId).after("<div id='btnEstop' style='z-index:999999;position:absolute;background-color:#ccc;filter:Alpha(Opacity-30);background:url(/images/ui-bg_flat_0_aaaaa_40x100.png) #aaaaaa repeat-x 50% 50%;opacity:0.3;'></div>");
??????????????? $("#btnEstop").css("width", ($("#" + buttionId).outerWidth() + 4));
??????????????? $("#btnEstop").css("height", ($("#" + buttionId).outerHeight() + 4));
??????????????? $("#btnEstop").css("left", ($("#" + buttionId).offset().left - 2));
??????????????? $("#btnEstop").css("top", ($("#" + buttionId).offset().top - 2));
??????????? }
??????? }
??????? //移除遮罩
??????? function RemoveEstopForButtton() {
??????????? $("#btnEstop").remove();
???????? }
??????
??? </script>
?<input value="启用遮罩" onclick="SetEstopForButton('myinput')" id="myinput" type="button" />
? <input value="移除遮罩" onclick="RemoveEstopForButtton()" id="Button1" type="button" />