Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Checking if an object exists


Message #1 by gbrown@c... on Fri, 29 Sep 2000 16:02:41 +0100
Did you try:

         if (document.form1)

or

         if (top.frames[3].form1)

in your case.

This works for frames, not sure about forms, but I guess it will

It's like the if document.all or document.layers thingy....


Imar




At 04:02 PM 9/29/2000 +0100, you wrote:
>Hi all
>
>I think this is a simple one but it is driving me nuts!
>
>I'm trying to check to see if a form is defined. If the user is just sat
>at the main menu this errors saying that btntop1 and form1 are not defined
>which is correct. They are only defined when I'm editing or adding. (Form1
>is the <form> that does the processing.
>
>         <TD valign=top> <a href="#" 
> onclick="btntop(top.frames[3].form1.btntop1);return false"> <IMG 
> SRC="images/btntop.gif" ID="btn2" alt="top" 
> onmouseout="btn2.src='images/btntop.gif'" 
> onmouseover="btn2.src='images/pbtntop.gif'" border=0></a></TD>
>
>I'd expected
>
>onclick="if(top.frames[3].form1==object){btntop(.........}"
>
>I've tried typeof..==object and != nill, null
>
>Any assistance would be gratefully received.
>
>Thanks
>
>Regards
>Graham
>
>
>



  Return to Index