there is a very simple way..i hope this helps
what u do is given here below.. do lemme know abt the success or failure of
the same
function getFocus()
{
if(document.getElementById("hdnVar")=="")
{
document.getElementById("hdnVar").value="test";
alert("Into getFocus ");
}
else
// do ur part here
}
</SCRIPT>
<FORM METHOD="POST" NAME="SF224">
<input type="hidden" name="hdnVar" id="hdnVar" value="">
<INPUT name="Appr001" type="TEXT" maxlength="10" > <BR><BR>
<INPUT name="Ent001" type="TEXT" maxlength="10" onfocus="getFocus();">
</FORM>
-----Original Message-----
From: Phil Kimble [mailto:phil@p...]
Sent: Sunday, August 11, 2002 1:53 AM
To: javascript
Subject: [javascript] onfocus in Netscape
I am using Netscape 4.78 and am trying to do data validation using both
onfocus and onblur functions. I have narrowed at least part of my problem
to the way Netscape handles the onfocus. In the following code, when my
second field gets focus I want to do some data validation and if necessary
print the alert and continue to other processing. However, it seems that
when I clear the alert, Netscape refires the onfocus function and I end up
in a loop. Is there a way to print a message to the user from within the
getFocus function without going into a loop? (BTW, IE does not have a
problem with this code. I would really like my app to work in both IE and
Netscape.)
Thanks for any help you can give me.
Phil
<HTML>
<HEAD>
<TITLE>SF224 </TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE=JavaScript>
function getFocus()
{
alert("Into getFocus ");
}
</SCRIPT>
<FORM METHOD="POST" NAME="SF224">
<INPUT name="Appr001" type="TEXT" maxlength="10" > <BR><BR>
<INPUT name="Ent001" type="TEXT" maxlength="10" onfocus="getFocus();">
</FORM>
</BODY>
</HTML>
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
r-20
**************************************************************************
This email (including any attachments) is intended for the sole use of the
intended recipient/s and may contain material that is CONFIDENTIAL AND
PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or
distribution or forwarding of any or all of the contents in this message is
STRICTLY PROHIBITED. If you are not the intended recipient, please contact
the sender by email and delete all copies; your cooperation in this regard
is appreciated.
**************************************************************************