[thelist] unobtrusify a lot of things...

Jon Hughes hughesj at firemtn.com
Thu Dec 6 10:15:54 CST 2007


Good morning, list!

I have a question of best practices here -

Currently, I have a function which I call unobtrusifier.

Function unobtrusifier() {
	Var emphasis =
getElementById("navigation").getElementsByTagName("em");
	for(var I = 0; i<emphasis.length;i++) {
		emphasis[i].onClick = function() { alert("hello"); }
	}

	Var images =
getElementById("content").getElementsByTagName("img");
	for(var I = 0; i<images.length;i++) {
		images[i].onClick = function() { alert("it's an image");
}
	}
}

Window.onload = unobtrusifier;

(note that I just wrote this from memory, so it probably doesn't
actually work...)


Is this how I should be doing it?  It works, but if there's a more
semantic way (or preferred way) of doing it, I would like to know.

Thank You,
- Jon Hughes 



More information about the thelist mailing list