Prototype modfies the core Array object and you shouldn't use any for
.. in -loops, instead do like this:
[...]
for (var i=0; $t = $aTOC[i]; i++) {
$temp += 't=' + $t + '<br />';
}
[...]
or a more prototypish way:
$("test1").innerHTML =
$A(document.getElementsByClassName('tocitem')).inject("",
function(iterator, element) {
iterator += element + "<br />";
return iterator;
});
Ciao!
Martin
--
burnfield.com/martin
On 6/21/06, Keith Davis <[EMAIL PROTECTED]> wrote:
function CreateTOC(){
var $aTOC = document.getElementsByClassName('tocitem');
var $temp = '';
if(isArray($aTOC)){
for($t in $aTOC){
$temp += 't=' + $t + ', ' + $aTOC[$t].name + '<BR>';
}
$('test1').innerHTML = $temp;
}
}
When I run this code as you see it, this is the result:
t=indexOf, undefined
t=without, undefined
t=flatten, undefined
t=compact, undefined
t=last, undefined
t=first, undefined
t=clear, undefined
t=_each, undefined
t=_reverse, undefined
t=entries, undefined
t=member, undefined
t=select, undefined
t=find, undefined
t=map, undefined
t=inspect, undefined
t=zip, undefined
t=toArray, undefined
t=sortBy, undefined
t=reject, undefined
t=pluck, undefined
t=partition, undefined
t=min, undefined
t=max, undefined
t=invoke, undefined
t=inject, undefined
t=include, undefined
t=grep, undefined
t=findAll, undefined
t=detect, undefined
t=collect, undefined
t=any, undefined
t=all, undefined
t=each, undefined
t=0, #Assessments Instruments
t=1, chiefcomplaint
t=2, History of Present Injury
The only tocitem's are the last three in that list. Where is the rest of
that array coming from?
_____________________
Thanks,
Keith Davis - MCSA, A+, N+
P.R.I.D.E. - Director of Computer Services
www.pridedallas.com
Work (214) 351-6600 ext. 119
Mobile (214) 906-5183
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs