Groups | Blog | Home
all groups > dotnet jscript > january 2004 >

dotnet jscript : validated in the Blur Event


shreekannan
1/19/2004 11:16:46 PM
Hai Techies,
Greetings!!!
I have a situation where the user entry in a text box control has to be validated in the Blur Event. If the user entry is invalid the cursor control has to be set in the same control(i.e., setting focus to the same control). For this i have written a client-side JavaScript code (given below). The code works fine in Internet Explore but fails with Netscape7.0 browser.
Can anyone help me to get rid of this failure in Netscape?

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
<TITLE></TITLE>
<script language="javascript">
function txtValidation()
{
if (document.form1.txtNum.value == "")
{
alert( 'Please enter a value');
document.form1.txtNum.focus();
}
}
</script>
</HEAD>
<BODY>
<form id="form1" name="form1">
<input type="text" id="txtNum" name="txtNum" onblur="txtValidation();" /> <input type="submit" ID="Submit1" NAME="Submit1" />
</form>
</BODY>
</HTML>

Your help is greatly appreciated.

With Rega rds,
Kannan

---
bruce barker
1/20/2004 9:27:43 AM
i see nothing wrong, and a quick test with netscape shows it works


[quoted text, click to view]
be validated in the Blur Event. If the user entry is invalid the cursor
control has to be set in the same control(i.e., setting focus to the same
control). For this i have written a client-side JavaScript code (given
below). The code works fine in Internet Explore but fails with Netscape7.0
browser.
[quoted text, click to view]
Community Website: http://www.dotnetjunkies.com/newsgroups/

AddThis Social Bookmark Button