DIG 4.8. getElementByClassName inserd of getElementById
|
|
Hello
i have replaced document.getElementById with document.getElementByClassName it this script http://diveintogreasemonkey.org/patterns/insert... var navbar, newElement;
But it doesn't work. Can somebody explain me why it doesn't work, and what to do to make it work?
|
|
|
I just find out that theres no such thing as document.getElementByClassName :/ |
|
|
From firefox 3.0 |
|
|
damn I can't wait for firefox 3 to roll out. it really doesn't matter though because it would mean forcing users to update first before they can use your script. here's a little function though. I'm having problems getting it to work with the XPCNativeWrapper. Can anyone help me out?
document.getElementsByClassName = function(className) {
var wrapper = new Array();
for (var dev = this.evaluate('//*[@class="'+className+'"]', this, null, 6, null), i = 0, div; div = dev.snapshotItem(i); i ++) {
wrapper.push(div);
}
return wrapper;
}
elements = document.getElementsByClassName("YOUR_CLASS_NAME");
|
