473,404 Members | 2,179 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Disable a button with javascript

Hi, I have to disable a button on a aspx page after the user clicks it.
I have to disable the button with javascript because the process takes
20 seconds to run the full course.

I kno I need to do this with javascript but I do not kno how.

Please tell me if you will please.

Nov 19 '05 #1
2 2035
> Hi, I have to disable a button on a aspx page after the user clicks it.
I have to disable the button with javascript because the process takes
20 seconds to run the full course.

I kno I need to do this with javascript but I do not kno how.

Please tell me if you will please.


Note that javascript is not foolproof, as a lot of useragents may not be
running javascript. So, it's best to check this on the server if you can.

However, to do it via javascript, here's a method I recently used:

I wrapped my submit button in a div, and then created another div that said
'please stand by while we update the database':

<div id="updatebutton"><asp:button /></div>
<div id="inprogress">Please stand by...</div>

Then I added this javascript to my HEAD tags:

<script lang="javascript">
function standbyShow() { // hide all the divs
document.getElementById('inprogress').style.displa y = 'block';
document.getElementById('updateButton').style.disp lay = 'none'; }
</script>

and in my codebehind, I attached the above function to the onClick action of
the button:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Form1.Attributes.Add("onSubmit", "standbyShow();")
End Sub

Now, in my case, I knew the people using this would have javascript (it's
for our intranet). For a public site, I'd go a step further and populate the
'standby' text in the second div via javascript as well, so that those
without javascript won't see this odd message.

-Darrel
Nov 19 '05 #2
On Mon, 07 Mar 2005 14:56:10 -0600, <bl*****@yahoo.com> wrote:
Hi, I have to disable a button on a aspx page after the user clicks it.
I have to disable the button with javascript because the process takes
20 seconds to run the full course.

I kno I need to do this with javascript but I do not kno how.

Please tell me if you will please.


Only if you say please :)

http://msmvps.com/anguslogan/archive.../22/27223.aspx

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: nntp | last post by:
I have a set of links which I want search engines to crawl them, but I want to disable them from my visitors, so I will ask the link owners to pay me to let me enable them. <a disabled...
2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
14
by: Sinity | last post by:
Anyone knows the method/codes to disable the clicked button after first click by using .aspx-- to prevent people to click many time when waiting for the server response. I tried to do this by...
6
by: Al Cohen | last post by:
I'm using a LinkButton to call some code, then do a redirect. The code does some queries, sends some emails, and takes a few moments before the redirect is performed. I'd like to disable my...
6
by: GD | last post by:
Hi, I wonder how to disable the "submit" behavior of a button. What I want is to assign values to dynamically added user controls without page postback. Problem: dynamically created control can...
3
by: Jeff | last post by:
I have a payment form with a submit button. A large percentage of users double-click the submit button thus submitting their payment information twice. I would like to use javascript to disable...
0
by: Robert Ladd | last post by:
Hi, I'm trying to disable the asp.net calendar control from a javascript function, but it doesn't disable the doPostBack. To simplify the situation, assume a page with 4 controls. A...
4
by: Patrick Flaherty | last post by:
Hi, Experienced programmer but new to PHP. Moreover I'm to use PHP with Xoops on top (this adds object orientation?). I don't seem to find a xoops Usenet group? Whatever the case (and...
8
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I disable the right mouse button? -----------------------------------------------------------------------...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.