|
Description: Returns an array of a specified element based on it's attributes. Syntax: searchElem(string, {parameters})function searchElem(a, b) { var n = []; outer: for(var i = document.getElementsByTagName(a), x = 0; x < i.length; x ++) { for(var e in b) if((b[e].constructor == RegExp ? !i[x][e].match(b[e]) : i[x][e] != b[e])) continue outer; n.push(i[x]); } return n; }Example: searchElem("td", { width: "1%", className: "windowbg" })
Last Edit: Apr 20, 2007 19:31:38 GMT by Aaron
|
|
|
|
You should allow for RegExp's by checking the constructor.
|
|
|
|
|
Yeah, added
Last Edit: Apr 20, 2007 19:32:11 GMT by Aaron
|
|
|
|
very nice. i was just thinking about a function that could do something similar to this the other day. glad you beat me to it
|
I'm starting this revolution: This is my sandbox, y'all just dig'n.
|
|
|
|
Now I'm content. Good job.
|
|
|
|