商业源码热门下载www.html.org.cn
<asp:button runat="server" id="btn" text="button" onclick="aa_click" />
以下是引用片段: public void page_load(object obj,eventargs e) { btn.attributes.add("onclick","state=true;"); stringbuilder sb=new stringbuilder(); sb.append("if (!state) return;"); sb.append("var button=document.getelementbyid(’btn’);"); sb.append("button.value=’please wait...’;"); sb.append("document.body.style.cursor=’wait’;"); sb.append("button.disabled=true;"); string strscript="<script>"; strscript=strscript +"var state=false;"; //将函数绑定到页面的onbeforeunload事件: strscript=strscript +"window.attachevent(’onbeforeunload’,function(){" +sb.tostring()+ "});"; strscript=strscript +"</"+"script>"; page.registerstartupscript("onbeforeunload",strscript); } protected void aa_click(object sender, eventargs e) { //模拟长时间的按钮处理 system.threading.thread.sleep(2000); response.write("<script>alert(’bbbbbb!!’);" + "</" + "script>"); } |
新闻热点
疑难解答
图片精选