473,597 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Executing javascript on post

I have an asp.net page that performs a function for a user that can
take up to 30 seconds. So, I have a javascript function that shows an
animation to let the user know something is going on. I have tied
this animation to the single button on the page with the following
piece of code:

btn_rc.Attribut es.Add("onClick ", "status_change( );")

This works great. When I click the button, I get the animation, and
when the page finishes the animation ends.

Now, since this is the only button on the page, I want to let the user
use the enter key to submit the form as well. So, with another piece
of code, I have successfully accomplished that:

Page.RegisterHi ddenField("__EV ENTTARGET", "btn_rc")

Now for the problem:

If the user hits the enter button to submit the form, it works but
does not display the javascript animation. How can I get the same
javascript animation to display if the enter key is hit vs. clicking
my submit button?

Thanks.
Scott
Nov 18 '05 #1
1 2438
Hi Scott,
How can I get the same javascript animation to display
if the enter key is hit vs. clicking my submit button?

You should be able to attach to the client-side form's onsubmit event to run
you javascript function just before the form gets submited.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx

To contact me remove 'NOSPAM'. Please post all questions to the newsgroup
"Scott" <sp*********@ya hoo.com> wrote in message
news:e6******** *************** ***@posting.goo gle.com... I have an asp.net page that performs a function for a user that can
take up to 30 seconds. So, I have a javascript function that shows an
animation to let the user know something is going on. I have tied
this animation to the single button on the page with the following
piece of code:

btn_rc.Attribut es.Add("onClick ", "status_change( );")

This works great. When I click the button, I get the animation, and
when the page finishes the animation ends.

Now, since this is the only button on the page, I want to let the user
use the enter key to submit the form as well. So, with another piece
of code, I have successfully accomplished that:

Page.RegisterHi ddenField("__EV ENTTARGET", "btn_rc")

Now for the problem:

If the user hits the enter button to submit the form, it works but
does not display the javascript animation. How can I get the same
javascript animation to display if the enter key is hit vs. clicking
my submit button?

Thanks.
Scott

Nov 18 '05 #2

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

Similar topics

15
1843
by: Michael Hill | last post by:
I have this cf script below where the javascript in it works perfectly i.e. a new window opens when I press 'click me' when I call it up using the url in the browser. But when I "POST" to it from another script the javascript window does not open when I click "click me". Is cf writing something kludgy to the browser when I post to it causing the javascript not to execute??
20
1721
by: JulioHM | last post by:
Hello, Not sure if this is the right discussion group to post this, but here it goes. For some god-forsaken reason (which I can't find out either) MSIE stopped executing any JavaScripts. In any page which contains JavaScript code, that code won't be executed. There are no error messages, no warnings, nothing. It simply does'nt work. I'm pretty sure this could be caused by some stupid installation of another program
4
3118
by: Guadala Harry | last post by:
Suppose I have a hyperlink that, when clicked, executes a JavaScript function on the client. Separately I have a button that, when clicked, causes a post back and executes a server-side function, as in the following: <a id="HyperLink5" href="javascript:DoSomethingInClient()">Do Something</a> <asp:Button id="btnSaveChanges" EnableViewState="true" CommandName="SaveChanges" Visible="true" Width="115" runat="server" Text="Save...
6
3570
by: Melih Onvural | last post by:
I need to execute some javascript and then read the value as part of a program that I am writing. I am currently doing something like this: import htmllib, urllib, formatter class myparser(htmllib.HTMLParser): insave = 0 def start_div(self, attrs): for i in attrs: if i == "id" and i == "pr":
15
7010
by: rage3324 | last post by:
I am posting html onto my main page between div tags using xmlhttprequest and innerhtml. The html I am posting has javascript inside which I am executing using the eval() function. However, the problem I face is that the javascript uses innerhtml as well and will not work for some reason. I have tested the javascript and it is definitely executing, it just will not change the innerhtml. To be more clear, the innerhtml is trying to access...
3
2114
by: Kirk | last post by:
Let me start by saying that I am a complete idiot when it comes to JS. However, I need help with something that apparently can only be done this way. I am using an ASP.NET AJAX control (ValidatorCallout) that requires client-side validation to work with a custom validator I added. This is an example of some code that works: <asp:CustomValidator ID="CV_PartNumberExists" runat="server" OnServerValidate="PrimeNumberCheck"
3
1920
by: leehanson | last post by:
I have a timer function that displays to the user the current number of seconds left for the current question. It all works fine, however when the timer is ticking down, and the user starts to drag the window, it stops. It seems to entirely stop javascript from executing. This issue is not seen in IE. Can anyone explain why Firefox stops executing JS when the window is moved/mouse is down over the blue top of the firefox window. I pray...
0
1559
Frinavale
by: Frinavale | last post by:
I have a peculiar problem... Background: I have a function that I don't want the user to execute more than once while they are waiting for it to process; therefore, I disable all of the controls on the page via some JavaScript before the request is sent. This function takes some time to execute because it has to communicate with hardware that is rather slow. This slowness combined with a little bit of lag sometimes results in a ...
0
7979
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7894
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8381
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8262
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5847
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5437
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3893
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1497
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1245
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.