Applying a function to multiple ids

Amiri
Thu, 03 Jul 2008 19:13:46 -0000

Hey folks.

I am trying to apply a function to multiple tables all with different
IDs. I got about halfway through copying and pasting the function and
just changing the ID before I realized this was absurd. But I don''t
know how to do this smarter with Prototype. Here is the function:

Event.addBehavior({
	''table#BULLETINS'': function() {
	    var links = $$(''table#BULLETINS
tr.header'').first().getElementsByTagName(''a'');
	    for (i=0; i<links.length; i++){
	        var link = links[i];
	        link.onclick = function() {return false;}
	    }
	}
});

So, I was copying this same code, changing "BULLETINS" to whatever ID
I required. How do you parametrize this exactly? I have an arbitrary
number of different IDs to apply this to, but I don''t know how to get
Prototype to watch for *any* of them, and then use the found ID,
whichever it is, in this function.

Amiri