On 19 Nov 98, John Stewart wrote:

> I have narrowed it to a point where I believe the problem is in the DOM
> model differences between the two browsers.  I have been through the
> webreview, webmonkey, and javascript site and still am at a loss as how to
> make a workaround work.  
> 
>  What I am trying to do is activate a "tool-tip" by the onMouseOver
> event on an image map.  The tool-tip is to be displayed in a blank area on
> the image map using the layers features.  Could some one provide a little
> sample of a work around?  The enclosed sample works in IE4.

Yeah, there are sure some big differences in the DOM between NS and 
MSIE when it comes to layers; and much as it pains me to admit it, MSIE 
is miles ahead in this respect.  Netscape has its proprietary <layer> tag, 
which is just a pain in the butt... NS *supposedly* also handles CSS 
positioning syntax properly, but this often isn't the case in practice.

As for your specific application: according to Goodman in "The Javascript 
Bible", the failure of your image-swap to work is more of a Netscape bug 
than a result of the different DOMs.  Basically, objects that are "hidden 
and shown again" within layers can sometimes become inaccessible.  
(Even though, as noted above, Netscape/Javascript is supposed to know 
what to do with objects tucked away in CSS layers.)

Anwyay... a suggested fix is to add a document.write() routine that will 
insert NS <layer> tags, above and beyond the CSS declaration (such as 
you have in your current code.)

I did some tinkering with the code you provided, and got a rough 
workaround functioning... or at least, it works in NS 4.  Don't know if it 
breaks MSIE as a result though.  Don't have that browser here.

What I did was tack on the following snippet at the end of your document 
(after the </div> for the org_chart.gif image):

        <script language="JavaScript">
        <!--

    document.write ("<layer name='phone' left='350' top='142'><img
    src='spacer.gif' width=140 height=40 border=0 alt='Spacer'
    name='spacer_img'></layer>") 

        //-->
        </script>

I also made some minor changes to the image-swap code itself:

1. Added a specific declaration for the "blank image" to the list of images:

          screen2 = new Image;
          screen2.src = "c200.gif";

        [snip]

          imgclear = new Image;
          imgclear.src = "spacer.gif";

('imgclear' corresponds to 'bottom_img' in your code)

2. Changed the img_inact function a bit:

        function img_inact(imgName)
        {
        if(document.images)
        {
                descrimgOff = eval(imgName.src);
                document["spacer_img"].src = "spacer.gif";

... where 'spacer_img' is the name I gave to 'spacer.gif' (see above, 
'document.write' part.)

Anyway... this does work with NS 4.5 on my system... I mouseover a link 
and the referenced graphic (c100.gif, etc) pops up over top.  When I 
mouseout, the "blank image" reappaers.  I assume this is what you wanted 
:)

Hope this is of some help.



-----------
Brent Eades, Almonte, Ontario
   E-mail: [EMAIL PROTECTED]
           [EMAIL PROTECTED]
   Town of Almonte site: http://www.almonte.com/
   Business site: http://www.federalweb.com

____________________________________________________________________
--------------------------------------------------------------------
 Join The Web Consultants Association :  Register on our web site Now
Web Consultants Web Site : http://just4u.com/webconsultants
If you lose the instructions All subscription/unsubscribing can be done
directly from our website for all our lists.
---------------------------------------------------------------------

Reply via email to