Javascript problem-Onblur function,please help

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
cty
Forum Newbie
Posts: 4
Joined: Thu Dec 14, 2006 11:03 pm

Javascript problem-Onblur function,please help

Post by cty »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


[syntax="html"]<html>

<head>


<title>You must login first before you order any book</title>

<script language=Javascript type="text/javascript">

function checkname(x)
{

if(x.value==""){
window.alert("you must enter a username")
x.focus()

}
}


function checkpass(y)
{

if(y.value==""){
window.alert("you must enter a password")
y.focus()

}
}
</script>

</head>
<body>






<a href="homepage.html"> Back To Home</a>


<form  name=reg method="POST" action="login.php">
	<p>&nbsp;</p>
	<p><b><font size="5">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	 You must login first before you order any book</font></b></p>
	<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
	Username
	<input type="text" name="username" size="20" onblur="checkname(this)"></p>
	<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
Password&nbsp;<input type="text" name="password" size="20" onblur="checkpass(this)"></p>
	<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="submit" value="Submit" name="B1">&nbsp;&nbsp;&nbsp;&nbsp; <input type="reset" value="Reset" name="B2"></p>
</form>

</body>

</html>
my problem is once the error message pop up,unable to stop it ,it will loop foever.How to edit this code?


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Remove the focus() call?
Post Reply