IE/Mac Hell
May 27, 2004 11:52 AM   Subscribe

Help, I'm stuck in IE/Mac hell! (It's the only browser we support for Mac at the moment, so it has to work there.) I have a dropdown list with various values: Page 1, Page 2, Page 3, etc. One of these values is set by the JSP as the current selected value: . Clicking on the value in the dropdown you want (Page 5, whatever) will bring you to that new page. The code is valid and works perfectly fine in IE/Win, Safari, Mozilla, etc. But on IE/Mac, when the new page loads, the value that's *visible* on screen in the dropdown box is not the currently-selected one, but rather whatever value was the first value in the dropdown list! So you could be on Page 1, go to Page 5, but Page 1 (the first option in the list of options) is what displays in the dropdown. To make matters funkier, when you then click to open that dropdown, it "jumps" to show you that yes, you're really on Page 5, that Page 5 is indeed the selected/highlighted value. So it's a display bug of some sort...?

I've seen plenty of bug reports and workarounds online for Mac/IE, but nearly all of them involve CSS, not core HTML pieces like options/selects. We do use CSS on the site, but it's minimal, and we generally use nested tables, inside which this naughty dropdown resides. Ideas to get around this--maybe javascript to force the correct value to display? Anyone else had this sort of issue? Help!
posted by Asparagirl to Computers & Internet (2 answers total)
 
Hm, that doesn't happen to me. What's the exact code you're using for selecting? I have this:

<option value='blah' selected="selected">Some item</option>

Try the dropdowns on this page on your Mac:
http://dali.lot23.com/ Do you see the same problem?
posted by jragon at 3:19 PM on May 27, 2004


Response by poster: After much testing and gnashing of teeth, we figured out the problem: it was faulty IE/Mac CSS handling after all.

The dropdown on the page was contained within a div tag that was set to style="display:none;" :

<div id="divInboxPaging_Inbox" name="divInboxPaging_Inbox" style="display: none;" class="inboxboldtext">
blah blah blah dropdown list goes in here
</div>

When the page loaded, *javascript* did a show or hide of the div tag, using getElementByID, switching the style of the div to either display:block or display:none, whichever was appropriate (based on other factors about the page):

document.getElementById('divInboxPaging_Inbox').style.display = "block";
-- or --
document.getElementById('divInboxPaging_Inbox').style.display = "none";

It turns out we "should" (by IE/Mac's funky rules) have set the div tag itself to start off as display:block. Then when the *exact same* javascript ran onLoad, it would show/hide the div tag appropriately, just as before. The difference is that if we had the page set the div as "show", however briefly before the javascript ran, it more fully built itself, if that makes sense, and thus the dropdown worked correctly.

We now have a brief flash of content (which quickly gets hidden by the javascript) to deal with, but at least it all works.

[shakes fist at Microsoft; anxiously awaits updates to Safari so I can stop being forced to develop for that POS browser...]
posted by Asparagirl at 4:40 PM on May 27, 2004


« Older Graduation Cap   |   Toilet Paper Strategies Newer »
This thread is closed to new comments.