The DOM property is element.nodeType, not element.type.
http://developer.mozilla.org/en/docs/DOM:element.nodeType


TAG

On Jun 21, 2007, at 9:30 AM, [EMAIL PROTECTED] wrote:

> On Jun 21, 4:22 pm, Tom Gregory <[EMAIL PROTECTED]> wrote:
>> I'll bet what you're seeing is an implicit toString() implementation
>> by the browser.  You're getting elements back, but it's converting
>> them output to hyperlinks when you alert().
>
> I thought that but if a test the value more explicitly in the
> iteration loop by outputting the type of the DOM object I get an
> undefined output or at least a NULL value.
>
> unction setupSwitches(){
>       //we define two arrays, containing our switches and divs.
>       var switchlinks = $$('a.switcher');
>       var stretchdivs = $$('.stretcher');
>       alert(switchlinks);
>       alert(stretchdivs);
>
>       //then we create the effect.
>       switchlinks.each(function(s){
>               alert(s.type); // This alert has not output at all it is NULL
>               s.onClick = function()
>               {
>                       // function actions here
>               }
>       });
> }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to