[Javascript] Check that field doesn't exist
David T. Lovering
dlovering at gazos.com
Mon Sep 15 19:34:39 CDT 2003
Yep. However, I would caution that you'll get an error if you try to telescope a long object description this way, providing that one of the intervening objects isn't defined. For example:
if (!document.frames["sweetums"].forms[0].myObject) {
// do something
}
will croak (and not "do something") if frames["sweetums"] doesn't exist, or hasn't been "painted" yet. Tedious though it may be, sometimes the best way is to do it incrementally, thusly:
while (!document) { }
while (!document.frames) { }
while (!document.frames["sweetums"]) { }
while (!document.frames["sweetums"].forms[0]) { }
// you're good to go ...
Ghastly, ain't it?
-- Dave Lovering
Clancy Jones wrote:
>
> Hi all, how do I check that a field doesn't exist?
>
> Something like:
>
> if (!document.form.fieldname){
> do whatever...
> }
>
> Cheers,
> Clancy
>
> _________________________________________________________________
> Surf the net and talk on the phone with Xtra Jetstream @
> http://www.xtra.co.nz/products/0,,5803,00.html !
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list