Hrrrm... I reread your quote of my reply, and it came across a bit  
abrasive.  Sorry about that.

I didn't see anything wrong with the Javascript, but I think I know  
what's going on.

It's been my experience that calling alert() in IE during an event  
callback does weird things.

Instead of assigning the onclick event inline in your HTML, use the  
Prototype event observer and extended event model:

// in a script *after* the <a> element is defined
// Again, this code hasn't been tested. You may have to debug a bit
Event.observe('BarPhysicalActivityIdLink', 'click', function(evt) {
        evt.stop();
        openSummarySection('BarPhysicalActivityId'); // actually, just drop  
the contents of this function here
});

On May 1, 2007, at 3:24 PM, [EMAIL PROTECTED] wrote:

>
> I admit, I got a little sloppy when trying to figure out just what the
> hell was going on.  This has been bugging me for 2 days.  I was trying
> a variety of things / anything really to see what the issue was.
>
> And I was premature on my last message.  The error is still
> happening.  And nothing has been changed since.  God, I love Internet
> Explorer.
>
> On May 1, 4:43 pm, Tom Gregory <[EMAIL PROTECTED]> wrote:
>> Why are you using $() everywhere?  Do it once, and clean up your  
>> code.
>>
>> var el    = $(el);
>> var sub = $(str+'Sub');
>>
>> if (el.hasClassName('bar')) {
>>      el.className = 'bar_open';
>> .... // etc.
>>
>> TAG
>>
>> On May 1, 2007, at 2:22 PM, [EMAIL PROTECTED] wrote:
>>
>>
>>
>>> I have a complete mystery with something happening in IE with
>>> JavaScript... Firefox, Opera, Safari, Mozilla. They all work.  
>>> Nothing
>>> is showing up in firebug.
>>
>>> I'm using the prototype library, BUT, this also happens when I
>>> hardcode everything document.getElementById.
>>
>>> The only way I can get this to work in IE is to have an Alert in the
>>> TRUE block of the if/else. Does that even make sense? The Alert is
>>> firing AFTER the className is set. So if the problems were arising
>>> from setting the class name it would fail before getting to the  
>>> alert.
>>
>>> There is no Exception thrown, there is no script error alert that  
>>> pops
>>> up or shows up in the lower left corner. IE just freezes.
>>
>>> I tried hacking around it using a hidden div, in hopes that would
>>> replace the Alert, but that didn't work either.
>>
>>> The Script freezing.  (I've tried several variations of this as  
>>> well).
>>
>>> function openSummarySection(str) {
>>>   try {
>>>     var sub = str + "Sub";
>>>     //alert(str + "\n" + sub + "\n" + $(str).className + "\n" + $
>>> (str).hasClassName('bar'));
>>>     // The above pops up with the correct values when not commented.
>>>     if ($(str).hasClassName('bar')) {
>>>       $(str).className = "bar_open";
>>>       $(sub).className = "bar_exposed";
>>> //        alert($(str).hasClassName('bar')); //<-- uncomment this  
>>> line
>>> and it works.  What the christ?
>>>     } else {
>>>       $(str).className = "bar";
>>>       $(sub).className = "bar_hidden";
>>>     }
>>
>>>   } catch(e) {
>>
>>>    alert(e.description);
>>
>>>   }
>>> }
>>
>>> The HTML:
>>> <div class="bar" id="BarPhysicalActivityId">
>>> <div class="turndown"><ul class="postnav2"><li>
>>> <a href="#" id="BarPhysicalActivityIdLink"
>>> onclick="openSummarySection('BarPhysicalActivityId');return
>>> false;"><img src="turn_up.gif"/></a>
>>> </li></ul></div>
>>> <div class="barlabel">Total Physical Activity</div>
>>> <div class="bartarget">0000</div>
>>> <div class="baractual">0000</div>
>>> <div class="baractualmeasure3">&nbsp;</div>
>>> <div class="barcomplete">&nbsp;</div>
>>> </div>
>>> <div id="BarPhysicalActivityIdSub" style="height:290px;"
>>> class="bar_hidden">stuff</div>
>>
>>> I know this is a ridiculously simple thing to fix.  But I'm  
>>> completely
>>> stumped.
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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