Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / November 2003

Tip: Looking for answers? Try searching our database.

Returning focus back to an control after an Alert()

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CES - 29 Oct 2003 06:22 GMT
All,

I'm trying to do a simple control validation that will pop an alert() and
then move the focus back to the tag. But I can't seem to get the focus() to
work properly. The only browser I can get this function to work properly in
is Opera and if I flip the focus() and alert() lines Opera stops working.

Also is their a way of selecting the whole line(value) when focus is
returned to the control as apposed to having the curser move to in front of
the first character.

Thanks in advance.
CES

function fValidateEmailAddress(sender){
var fName = document.forms[fGetFormName(sender)];
var cValue = fName.elements['id_' + sender].value;
var a = cValue.split("@");
var aText = "Improper Format for an E-Mail Address!"

if ((a.length == 2) && (a[0].length >= 1)){
 var b = a[1].split(".");
 if ((b.length == 2) && (b[0].length > 1) && (b[1].length > 1)){
  fRemoveAsterisk(sender);
 }
 else{
  alert(aText);
  //fName.elements['id_' + sender].focus();
 }
}
else{
 alert(aText);
  //fName.elements['id_' + sender].focus();
}
}
name - 05 Nov 2003 08:19 GMT
Yuu need an 'event function'

that
both ways

does it

> All,
>
[quoted text clipped - 31 lines]
>  }
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.