Javascript browser compatability problems


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Javascript browser compatability problems

  1. #1
    Tim Walsh Guest

    Javascript browser compatability problems


    Dear anyone,

    help!

    My site:

    http://www.pinpointresearch.com.au

    uses rollover navigation buttons located in a frame at the top of the web
    page and another to the left of the web page. The rollover buttons swap an
    image when the mouse rolls over them. Each button is placed within a table.
    Each cell of the table is assigned a size percentage terms and each rollover
    picture (they are a series of Gifs) are given size properties of 100% - this
    allows them to be resized to fit larger or smaller screen resolutions.

    This works fine in IE4.0+ but does really weird things in Netscape (only
    some images are shown, some images appear larger, etc).

    I'd be grateful for any advice or help you can provide.

    Best regards,


    Tim Walsh


  2. #2
    Paul Guest

    Re: Javascript browser compatability problems


    Looks like you have problems. (suggestion: do not look at it with Netscape
    6.0, it is really messed up!) I can not tell directly what is going on with
    the script. My best suggestion is to use Dreamweaver and use the script
    they have for roolover images. or you could "borrow the following script:

    <SCRIPT language=JavaScript>
    <!--
    function MM_swapImgRestore() { //v3.0
    var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
    x.src=x.oSrc;
    }

    function MM_preloadImages() { //v3.0
    var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
    i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    }

    function MM_findObj(n, d) { //v3.0
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length)
    {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    return x;
    }

    function MM_swapImage() { //v3.0
    var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src;
    x.src=a[i+2];}
    }
    //-->
    </SCRIPT>

    on the body tag have this:

    onload=MM_preloadImages('image1.gif','images2,gif')


    image1.gif and image2.gif represent where the images are to be loaded.

    and the ref tag have the image to swap:

    <A href="wherever" target="if any" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('name
    image','','image that goes over',1);" ><IMG name="name image" src="image
    as original" width="?" height="?" border="0"></A>

    Hope this helps!

    Later


    "Tim Walsh" <tw@pinpointresearch.com.au> wrote:
    >
    >Dear anyone,
    >
    >help!
    >
    >My site:
    >
    >http://www.pinpointresearch.com.au
    >
    >uses rollover navigation buttons located in a frame at the top of the web
    >page and another to the left of the web page. The rollover buttons swap

    an
    >image when the mouse rolls over them. Each button is placed within a table.
    >Each cell of the table is assigned a size percentage terms and each rollover
    >picture (they are a series of Gifs) are given size properties of 100% -

    this
    >allows them to be resized to fit larger or smaller screen resolutions.
    >
    >This works fine in IE4.0+ but does really weird things in Netscape (only
    >some images are shown, some images appear larger, etc).
    >
    >I'd be grateful for any advice or help you can provide.
    >
    >Best regards,
    >
    >
    >Tim Walsh
    >



  3. #3
    john Guest

    Re: Javascript browser compatability problems


    The script below MM (Macromedia) is produced in Dreameweaver 3 and it will
    cause the problems associated with Netscape 4 - 4.75...my guess is you already
    knew that. My advice after suffering this same MM problem - WRITE THE SCRIPT
    ON YOUR OWN - yes this sucks considering MM is so easy, but guess what...IT
    DOES NOT WORK IN NETSCAPE BROWSERS!!!






    "Paul" <paul@nowhere.com> wrote:
    >
    >Looks like you have problems. (suggestion: do not look at it with Netscape
    >6.0, it is really messed up!) I can not tell directly what is going on

    with
    >the script. My best suggestion is to use Dreamweaver and use the script
    >they have for roolover images. or you could "borrow the following script:
    >
    ><SCRIPT language=JavaScript>
    ><!--
    >function MM_swapImgRestore() { //v3.0
    > var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
    >x.src=x.oSrc;
    >}
    >
    >function MM_preloadImages() { //v3.0
    > var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    > var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;
    >i++)
    > if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
    >}
    >
    >function MM_findObj(n, d) { //v3.0
    > var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length)
    >{
    > d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    > if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    > for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    >return x;
    >}
    >
    >function MM_swapImage() { //v3.0
    > var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
    > if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src;
    >x.src=a[i+2];}
    >}
    >//-->
    ></SCRIPT>
    >
    >on the body tag have this:
    >
    >onload=MM_preloadImages('image1.gif','images2,gif')
    >
    >
    >image1.gif and image2.gif represent where the images are to be loaded.
    >
    >and the ref tag have the image to swap:
    >
    ><A href="wherever" target="if any" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('name
    >image','','image that goes over',1);" ><IMG name="name image" src="image
    >as original" width="?" height="?" border="0"></A>
    >
    >Hope this helps!
    >
    >Later
    >
    >
    >"Tim Walsh" <tw@pinpointresearch.com.au> wrote:
    >>
    >>Dear anyone,
    >>
    >>help!
    >>
    >>My site:
    >>
    >>http://www.pinpointresearch.com.au
    >>
    >>uses rollover navigation buttons located in a frame at the top of the web
    >>page and another to the left of the web page. The rollover buttons swap

    >an
    >>image when the mouse rolls over them. Each button is placed within a table.
    >>Each cell of the table is assigned a size percentage terms and each rollover
    >>picture (they are a series of Gifs) are given size properties of 100% -

    >this
    >>allows them to be resized to fit larger or smaller screen resolutions.
    >>
    >>This works fine in IE4.0+ but does really weird things in Netscape (only
    >>some images are shown, some images appear larger, etc).
    >>
    >>I'd be grateful for any advice or help you can provide.
    >>
    >>Best regards,
    >>
    >>
    >>Tim Walsh
    >>

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center