M
Mahesh
Hi all,
Can any one advice what can be a work around here?
When i run the code below, its showing the alert msg twice onfocus out
of tf1
Thanks in advance,
Maheshkumar
<html>
<script type="text/javascript">
function setFocus(ref) {
globalTakeFocus=ref;
setTimeout("globalTakeFocus.focus();globalTakeFocus.select()",100);
}
function checkfun()
{
if(document.getElementById("tf1").value=="")
{
//document.getElementById("tf1").focus();
alert("The field is empty");
setFocus(document.getElementById("tf1"));
return;
}
if(document.getElementById("tf2").value=="")
{
//document.getElementById("tf2").focus();
alert("The field is empty");
setFocus(document.getElementById("tf2"));
return;
}
}
</script>
<body>
<table>
<form>
<tr> <td>
TF1: <input id="tf1" type="text" value="" onblur="checkfun();"/></td>
</tr>
<tr><td>
TF2: <input id="tf2" type="text" value="tf2" onblur="checkfun()"/></
td>
</tr>
</form>
</table>
</body>
</html>
Can any one advice what can be a work around here?
When i run the code below, its showing the alert msg twice onfocus out
of tf1
Thanks in advance,
Maheshkumar
<html>
<script type="text/javascript">
function setFocus(ref) {
globalTakeFocus=ref;
setTimeout("globalTakeFocus.focus();globalTakeFocus.select()",100);
}
function checkfun()
{
if(document.getElementById("tf1").value=="")
{
//document.getElementById("tf1").focus();
alert("The field is empty");
setFocus(document.getElementById("tf1"));
return;
}
if(document.getElementById("tf2").value=="")
{
//document.getElementById("tf2").focus();
alert("The field is empty");
setFocus(document.getElementById("tf2"));
return;
}
}
</script>
<body>
<table>
<form>
<tr> <td>
TF1: <input id="tf1" type="text" value="" onblur="checkfun();"/></td>
</tr>
<tr><td>
TF2: <input id="tf2" type="text" value="tf2" onblur="checkfun()"/></
td>
</tr>
</form>
</table>
</body>
</html>