I'd like to do this in JavaScript. To clarify, I mean a page. Sorry about that.
Try this:
top != self
top
refers to the top window and self
to the own window.
Do you mean a form element, or a page?
If form, i've never considered having an element inside a separate frame before, but I don't think this is possible in the way you are thinking.
Elements have to be inside forms, and forms have to be inside pages.
You can have an element, or a form, inside a page, inside a frame on another page, but the two pages will still be separate pages, and the forms will be separate forms.
You can't have a single form that spans multiple pages.
You can, however, have multiple forms that act as a single process across pages, or you can use AJAX to include content (including form elements) from outside the page, but they become part of the page once they are included.
Perhaps one of these options is what you need?
You can also have, I suppose an element on another page, in a frame, which you then access via JavaScript, but that element will still be in a separate form, in a separate page.
element.ownerDocument.parentWindow.frameElement!=null
However, this only works if you are in the same domain, trying to grab the frame for another domain will give you a cross site scripting access error