-
IsObject in Javascript
Hello Everybody,
i want to get the souce code for isobject function
in javascript.
I want to validate the form conditionally ,if a textbox named
txtname is present then validate its value else don't do,
But here what's happening means ,if the textbox is present
my function validating else its telling object not found ,
So how can i detect the occurance the object in a html page at the
client side itself.
Aniz
-
You can easily check if there's a specific item in the form by using an standard "if":
Code:
<script language="javascript">
function checkTxtBox()
{
if (document.frm.txtname)
{alert("There is a box!");}
else
{alert("There isn't a box!");}
}
</script>
<form name="frm">
<input type="text" name="txtname" value="test">
<input type="button" onClick="checkTxtBox()">
</form>
/fredrik