Hi,
I would say that it comes from your ids.
In fact, an "id" should be unique in a page. You should use "class"
instead when you want several object to have the same behaviour.
To access them, simply do $$('.num') and in your div's, change id=num
by class="num" (it's a good practice to put "s as you can have several
classes).
HTH,
Julien.
On Jun 22, 3:33 pm, KingKong99 <[email protected]> wrote:
> I have very simple code as below:
>
> <html>
> <head>
> <script src=prototype.js></script>
>
> <script>
> document.observe('dom:loaded',function(){
> var nums = $$('#num');
>
> alert(nums.length);
>
> });
>
> </script>
>
> </head>
> <body>
> <div id=bb>
>
> <div id=num_container>
> <div id=num>1</div>
> <div id=num>2</div>
> <div id=num>3</div>
> <div id=num>4</div>
> <div id=num>5</div>
> </div>
>
> </div>
> </body>
> </html>
>
> There is no problem in Chrome or Firefox but IE8. It should alert
> number 5 not 1.
>
> Anyone please help. What am I do wrong?!!
>
> Thank you
> King
--
You received this message because you are subscribed to the Google Groups
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/prototype-scriptaculous?hl=en.