|
-
Feb 27th, 2002, 03:37 PM
#1
Thread Starter
Member
Script for checking if a form element exists?
My form is dynamically created based on a recordset. If there's more than one record, radiobuttons are created to allow the user to select which item...etc.
If only one record is returned, no radiobutton is created, since I don't need one.
Now, how do I find out if the radio element exists? Something like:
if (exists(document.form1.radio))
(although this keeps giving me an "Object expected" error).
Any help appreciated.
Cindy
-
Feb 27th, 2002, 04:37 PM
#2
Frenzied Member
I really hate the whole document.form1.radio approach. Look up the doco on getElementById(). It is a method of the document object. I would imagine it would return a Null object if your radio button wasn't present.
Travis, Kung Foo Journeyman
As always, RTFM.
WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
YBMS, but Mozilla doesn't.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|