Results 1 to 2 of 2

Thread: IsObject in Javascript

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2001
    Location
    india
    Posts
    109

    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
    I respect love and lovers ,but it should be possesive .
    I love friendship and friends but it should be true.

  2. #2
    Lively Member
    Join Date
    May 2001
    Location
    Falkenberg, Sweden
    Posts
    76
    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
    ________________________
    Fredrik Klarqvist

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width