|
-
Nov 25th, 2001, 02:52 PM
#1
getElementById and multiple tags...
Lets say I have 2 or more elements with the ID "total". I am passing the index of the one I want to a function. I thought I could say:
document.getElementById('total')[index].innerText = "Whatever";
by that doesn't work. Is there a way I can do this?
Thanks
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 26th, 2001, 10:45 AM
#2
Frenzied Member
Uhm, no. ID is meant to be a unique ID.
You can crawl through the document (so to speak) and grab the element you want if you know where it is. But getElementById will have unpredictable results.
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
|