#1 (permalink)  
Old 05-12-2005, 10:27 AM
Registered User
 
Join Date: May 2005
Posts: 2
IE <div> onMouseOver issue

I'm using the pre-installed scripts in DreamWeaver MX for mouseover buttons and hide/show layer. They seem pretty solid, never had a problem with the mouseover buttons in any browser. Makes my life simpler. It's the hide/show layer addition to the script that makes me want to pull what little hair I have left out.

Here is a demo of a site I'm building at work: http://www.thegazz.com/demo (I only build them, I don't name them).

In both IE and Firefox the mouseovers with drop down layers work fine. It's when I goto hover over the layers that IE faulters. I figured it was a compatability issue, that maybe IE doesn't recognize mouseovers in div tags. What really confuses me, if you test the demo, the first drop down works and stays. The structure is the same for each layer, so I'm stumped. Why would it work for the first and not the others? And the code obviously works since the mouseover portion shows.

Code:
// Example: showHideLayers(Layer1,'','show',Layer2,'','hide');
function showHideLayers()
{ 
  var i, visStr, obj, args = showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  {
    if ((obj = MM_findObj(args[i])) != null)
    {
      visStr = args[i+2];
      if (obj.style)
      {
        obj = obj.style;
        if(visStr == 'show') visStr = 'visible';
        else if(visStr == 'hide') visStr = 'hidden';
      }
      obj.visibility = visStr;
    }
  }
}
Reply With Quote

  #2 (permalink)  
Old 05-12-2005, 10:33 AM
Registered User
 
Join Date: May 2005
Posts: 2
Also, I should have mentioned. I've removed the first mouseover thinking the second one would work in IE, no, still didn't. I also copied the tags for the other mouseovers to the first section, only to find they did work.

I just can't wrap my head around what is different.
Reply With Quote
  #3 (permalink)  
Old 05-12-2005, 06:32 PM
tthurgo's Avatar
Moderator
 
Join Date: Jan 2002
Location: Lebanon, PA
Posts: 357
This is tough since it uses another function from dreamweaver (mm_findobj). So anyway, here is a piece of code that should work.

Code:
function show_hide_layer(the_layer){
  if(document.getElementById(the_layer).style.display == 'none'){
    document.getElementById(the_layer).style.display = 'inline';
  }else{
    document.getElementById(the_layer).style.display = 'none';
  }
}
Works for me in IE, Firefox, Safari and so on. Even Opera does it (I think! ).
__________________
Tom Thurgo
my future is coming on
Reply With Quote
  #4 (permalink)  
Old 02-14-2006, 08:35 AM
Registered User
 
Join Date: Feb 2006
Posts: 4
Lightbulb maybe this is shorter one

HTML Code:
<script type="text/javascript">function showhide(ide){ex = document.getElementById(ide).style;ex.display=(ex.display=='block')?'none':'block';}</script>
if you want inline, just change the display value "block" to "inline". the functionality is same as^^
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT -5. The time now is 11:35 PM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter