PDA

View Full Version : HELP, focus not working help!



ducman_666
10 Aug 2009, 11:22 PM
Hi, building a website and my focus isn't working, my code follows:

<head>
<script lang="javascript">
function checkemail() {
var EmailAddress = (tella.email1.value);
var Length = EmailAddress.length;
var Count = 0;
var Loop = 0;
var Character
while (Loop < Length) {
Character = EmailAddress.charAt(Loop);
if (Character == "@") {
Count = Count + 1;
}
Loop = Loop + 1;
}
if (Count != 1) {
alert("Please check your email address");
tella.email1.focus(); // this line doesn't work, it will not focus back to the box

}
else
{checkemail2()}
}
function checkemail2() {
var EmailAddress = (tella.email2.value);
var Length = EmailAddress.length;
var Count = 0;
var Loop = 0;
var Character
while (Loop < Length) {
Character = EmailAddress.charAt(Loop);
if (Character == "@") {
Count = Count + 1;
}
Loop = Loop + 1;
}
if (Count != 1) {
alert("Please check your friends email address");
tella.email2.focus();// same thing happens

}
else
{submitit()}
}
function submitit() {
alert("You have told your friend about McCue Bros & Co")
}
</script>


<title>McCue Brothers & Co</title>
</head>

fangzhouxing
11 Aug 2009, 12:33 AM
see: http://extjs.com/forum/showthread.php?p=369867