<html>
<head>
<script>
function IsNull()
{
if(event.srcElement.value.length==0)
{
alert("null is forbidden!");
alert(event.srcElement.id);
event.srcElement.focus();
alert("OK")
}
return;
}
</script>
</head>
<body>
<input type="text" name="s1" id="s1" onblur="IsNull()">
<input type="text" name="s2" id="s2" onblur="IsNull()">
~~~~
</body>
</html>
<head>
<script>
function IsNull()
{
if(event.srcElement.value.length==0)
{
alert("null is forbidden!");
alert(event.srcElement.id);
event.srcElement.focus();
alert("OK")
}
return;
}
</script>
</head>
<body>
<input type="text" name="s1" id="s1" onblur="IsNull()">
<input type="text" name="s2" id="s2" onblur="IsNull()">
~~~~
</body>
</html>
<head>
<script>
function IsNull()
{
if(event.srcElement.value.length==0)
{
alert("null is forbidden!");
alert(event.srcElement.id+" is checking");
event.srcElement.focus();
alert("OK")
}
return;
}function focusThis()
{
alert(event.srcElement.id+" is focus");
}
</script>
</head>
<body>
<input type="text" name="s1" id="s1" onfocus="focusThis()" onblur="IsNull()">
<input type="text" name="s2" id="s2" onfocus="focusThis()" onblur="IsNull()">
</body>
</html>
var ErrorObj = null;
function IsNull()
{
if(ErrorObj!=null && ErrorObj!=event.srcElement)
{
return;
}
ErrorObj = null;
if(event.srcElement.value.length==0)
{
alert("null is forbidden!");
event.srcElement.focus();
ErrorObj = event.srcElement;
}
return;
}