473,666 Members | 2,157 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

setfocus after alert in javascript

amy
I have a text box, once the user input the value in, I do a validate
to the input, if it's invalid, then do a alert and set focus to this
control.

The alert displays, but the set focus doesn't work.Here is the client
side javascript code,

if (run!="" && IsNumber(run)== false && decimalinputval id(run,2)==0 )
{
alert('This field only allows the entry of a maximum of 2 decimal
places. Please re-enter a correct value.');
//set focus
document.paperc altbl.printorde r.focus();
}

Please give some advise. Thanks in advance.
Jul 19 '05 #1
1 2035
amy wrote on 02 feb 2004 in microsoft.publi c.inetserver.as p.general:
I have a text box, once the user input the value in, I do a validate
to the input, if it's invalid, then do a alert and set focus to this
control.

The alert displays, but the set focus doesn't work.Here is the client
side javascript code,

if (run!="" && IsNumber(run)== false && decimalinputval id(run,2)==0 )
{
alert('This field only allows the entry of a maximum of 2 decimal
places. Please re-enter a correct value.');
//set focus
document.paperc altbl.printorde r.focus();
}

Please give some advise. Thanks in advance.


This has nothing to do with ASP, serverside coding.

Please see a clientside js NG.
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2

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

Similar topics

1
3255
by: amy | last post by:
I have a text box, after user input the value, a validate function trigered. if the value is invalid, alert display, and also set focus back to this control. The alert displays, but when the click the 'OK' in the alert, the set focus to this field does not work. see the code bellow: if (run!="" && IsNumber(run)==false && decimalinputvalid(run,2)==0 )
2
16858
by: schieco | last post by:
The following code always prints the debug lines inside the conditional if statement before and after the alert statement when the session has timed out, but the alert and redirect only appear/work in certain situations. <% // Check for expired session log.debug("session ID = " + session.getAttribute("session_loginID")); if (session.getAttribute("session_loginID") == null)
4
9674
by: Mad Scientist Jr | last post by:
i am trying to set focus to a specific control depending on the outcome of a validator control and it is not working. none of these methods are working to setfocus: 1. RegisterStartupScript("sf","<scriptlanguage='javascript'>document.form.MyControlID.focus();</script>"); 2. Andy Smith's FirstFocus control from http://www.metabuilders.com/tools/FirstFocus.aspx
6
1957
by: CoTConnie | last post by:
I'm trying to setfocus on a textbox after an error conditions, but the compile insists that 'textbox.setfocus' isn't a valid command. I'm using all the web page default setting, but am creating it in a FrontPage environment. Does anyone know what I can do to make this command work?
4
1394
by: jonefer | last post by:
They couldn't have done away with how to setfocus to a control... like in response to an incorrect value input to a textbox... If Not IsDate(txt_DOB) then txt_DOB.SetFocus End If How do I do that?
0
1521
by: MrsLeigh | last post by:
I have a datagrid on a web page. In the footer there is a field that should be recieve the focus, either at the start or after a button is clicked to insert the row that is being added in the footer. I created the following Sub... Private Sub SetFocus(ByVal ctrl As Control) Dim SetFocus As String = "<script language='javascript'>document.getElementById(""" & ctrl.ClientID & """).focus();</script>"
3
9673
by: umdsasha | last post by:
So, basically, I need to detect whether an alert window was thrown. I can't find where it's thrown from but I need to disable a button only if there were no alert windows thrown. Any ideas? Thanks Alex
2
2984
by: gnewsham | last post by:
I am converting an application from vb.net 2003 to 2005 I have the following function which I call when an input error is detected: Private Sub SetFocus(ByVal ctrl As System.Web.UI.Control) Dim s As String = "<SCRIPT language='javascript'>document.getElementById('" & ctrl.ID & "').focus() </SCRIPT>" RegisterStartupScript("focus", s) End Sub
4
4015
by: joe | last post by:
Hi, I defined: <div id="abc"> </div> in my .html file, after an Ajax query my weberserver sends: <script language="JavaScript"> alert('Hello World!"); </script>
24
8204
by: Jeremy J Starcher | last post by:
While reading c.l.j, I've noticed that some people prefer and indeed even recommend the use of "window.alert()" over "alert()". I can't find any technical reason to make this distinction, and seems to have a (tiny) amount overhead since window itself points to the global object, hence, a circular reference. (From everything I am reading, window is just a REFERENCE back to the global object, as opposed to a separate object.)
0
8454
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
8878
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8644
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...
0
7389
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6200
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
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2776
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1778
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.