单击按钮时禁用

编程入门 行业动态 更新时间:2024-10-28 14:34:27
本文介绍了单击按钮时禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

单击按钮后是否有办法禁用按钮? 我试图避免让某人在等待时点击两次 来处理。 谢谢!

Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!

推荐答案

嗨巴里, 这应该有效: Button1.Attribute.Add(" onclick"," this.disabled = true; 文件.Form1.submit();返回false;") 我没有测试它,但我知道你需要自己提交表格并且可以使用 提交按钮上的事件气泡。祝好运! Ken。 - Ken Dopierala Jr. 对于优秀的ASP.Net网站托管尝试: www.webhost4life/default.asp?refid=Spinlight 如果您在我这里注册并需要帮助,请给我发电子邮件。 " Barry Gilmore" <无********** @ yahoo>在消息中写道 news:ro ************** @ tornado.rdc-kc.rr ... Hi Barry, This should work: Button1.Attribute.Add("onclick", "this.disabled = true; document.Form1.submit(); return false;") I didn''t test it but I know you need to submit the form yourself and cancle the event bubble on the submit button. Good luck! Ken. -- Ken Dopierala Jr. For great ASP.Net web hosting try: www.webhost4life/default.asp?refid=Spinlight If you sign up under me and need help, email me. "Barry Gilmore" <no**********@yahoo> wrote in message news:ro**************@tornado.rdc-kc.rr... 是有一种方法可以在单击按钮后禁用按钮吗? 我试图避免让某人在等待处理它时两次点击它。 谢谢! Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!

在onClick事件(javascript)中添加以下代码,将停止用户 再次按下 document.getElementById(''buttonname'')。disabled =''tr ue''; " Barry Gilmore"写道: adding following code in the onClick event (javascript), will stop the user from pressing it again document.getElementById(''buttonname'').disabled=''tr ue''; "Barry Gilmore" wrote: 有没有办法在点击按钮后禁用按钮? 我试图避免在等待时有人点击它两次它需要处理。 谢谢! Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!

Barry, 我有一个javascript,首先调用'内置的 身份验证脚本,以确保表单可以提交(你不会 想要禁用一个按钮,如果客户端脚本确定它无效并且 没有提交,从而搁置用户)然后禁用第二次点击 表示按钮。 该代码作为Javascript组件的一部分提供,可以从我的网站作为Visual Studio免费下载。 Net 2003项目。即使你不想使用整个组件(它还有其他脚本,比如打开一个 居中的弹出窗口,当输入键是的时候点击一个按钮在 a文本框中按下,滚动到页面上的元素等等。)你可以随时删除 你想要的代码。我网站上的所有组件都是免费的,所有组件都带有 完整的源代码,如果你想要的话,你可以下载一个帮助文件。 您可以从这里下载组件: www.aboutfortunate?page=javascript - 此致, S. Justin Gengo,MCP 网站开发人员/程序员 www.aboutfortunate 混乱无序。 Nietzsche " Barry Gilmore" <无********** @ yahoo>在消息中写道 news:ro ************** @ tornado.rdc-kc.rr ... Barry, I have a javascript that first makes a call to ''s built in authentication scripts to make certain a form is submittable (you wouldn''t want to disable a button if the clientside script decides it''s not valid and doesn''t submit thus stranding the user) and then disables a second click of said button. The code is available as part of a Javascript component that is free for download from my website as a Visual Studio.Net 2003 project. Even if you don''t want to use the whole component (it has other scripts such as open a centered popup window, click a button when the enter key is pressed while in a text box, scroll to an element on the page, etc.) you could always strip out the code you want. All the components on my site are free, all come with complete source code, and there is a help file you may download if you''d like. You may download the component from here: www.aboutfortunate?page=javascript -- Sincerely, S. Justin Gengo, MCP Web Developer / Programmer www.aboutfortunate "Out of chaos comes order." Nietzsche "Barry Gilmore" <no**********@yahoo> wrote in message news:ro**************@tornado.rdc-kc.rr... 是有一种方法可以在点击按钮后禁用按钮吗? 我试图避免让某人在等待处理它时两次点击它。 谢谢! Is there a way to disable a button after it is clicked? I am trying to avoid having someone click on it twice while they wait for it to process. Thank you!

更多推荐

单击按钮时禁用

本文发布于:2023-11-10 01:39:46,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1574009.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单击   按钮

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!