[thelist] [DHTML] Elements with the same ID

Martin martinmc116 at austin.rr.com
Wed Mar 19 01:59:20 CST 2003


Ouch!!
Is foo1 and foo! a straight, "hey, dumb ass....?" (i.e. fool). If so, get
off the web, no one develops with such abusive assaults.

If not, this reply does not apply to you.
Martin

ps. I noticed there was no signature.----- Original Message -----
From: "Erik Mattheis" <gozz at gozz.com>
To: "thelist at lists.evolt.org.uk" <thelist at lists.css-discuss.org>
Sent: Tuesday, March 18, 2003 9:37 PM
Subject: Re: [thelist] [DHTML] Elements with the same ID


> It's not an id if it's not unique!
>
> Maybe you should do something like:
>
> <p id="foo1">text</p>
> <p id="foo2">more text</p>
>
> and find them like:
>
> function getFoo() {
> tags = document.getElementsByTagName('p');
> for (i = 0; i < tags.length; i++) {
> if (tags[i].attributes.id.value.substr(0,3) == 'foo') {
> alert('i got foo!');
> }
> }
> }
>
>
> On Tuesday, March 18, 2003, at 10:47 PM, Mark M wrote:
>
> > Quick question.
> >
> > If you have multiple elements that have the same id in a page.. can
> > you access
> > them all through the same ID? or does the system automatically create
> > an array
> > you can loop through under that ID?
> >
> > The reason I ask is because we have a series of images on a page that
> > we want to
> > hide/display on a single click... if we give them all the same ID it
> > makes life easy.
> >
> > Thanks in advance,
> >
> -----------------------
> Erik Mattheis
> GoZz Digital
> <http://goZz.com/>
> Flash and ColdFusion Development
> Minneapolis, MN
> -----------------------
>
> --
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !



More information about the thelist mailing list