|
#1
|
|||
|
|||
|
how can i use a function to get elements by their className?
thanks |
|
#2
|
||||
|
||||
|
Here's one from the Switch Content II script in the DD Library:
Code:
function getElementbyClass(rootobj, classname){
var temparray=new Array()
var inc=0
var rootlength=rootobj.length
for (i=0; i<rootlength; i++){
if (rootobj[i].className==classname)
temparray[inc++]=rootobj[i]
}
return temparray
}
__________________
WWWWWWWWWWWW - John________________________ Really Show Your Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate |
|
#3
|
||||
|
||||
|
I've always used this one.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP! |
|
#4
|
|||
|
|||
|
thanks twey, that is excellent!
Agrajag |
|
#5
|
|||
|
|||
|
Quote:
The Array.prototype.push method substitute is bogus, though. Mike |
|
#6
|
||||
|
||||
|
The IE5-support one?
Does IE5 already have one? Perhaps Code:
if(!Array.push) Array.prototype.push = function(val) {
this[this.length] = value;
}
Quote:
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP! |
|
#7
|
|||
|
|||
|
Quote:
Mike |
|
#8
|
||||
|
||||
|
Quote:
I seem to remember you doing something like this before, also with a argument named "v," as I recall.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP! |
|
#9
|
|||
|
|||
|
Quote:
The Array.prototype.push method is defined as having a length property value of 1. For user-defined functions, the only way to affect the length property is via the formal argument list; the property itself is read only.Mike |
|
#10
|
||||
|
||||
|
Aha, I see.
Qualm dismissed.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP! |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|