Changing menu image

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bzi999@gmail.com

    Changing menu image

    Hi!
    I'm trying to create a javaxcript application that changes a image menu
    by following the mouse, something like:

    <!-- menu images are m1, m2, m3.gif-->
    <script language="JavaS cript">
    function option1()
    { document.getEle mentById("menu" ).write("<img src=m1.gif>"); }
    function option2()
    { document.getEle mentById("menu" ).write("<img src=m2.gif>"); }
    ....</script>

    <div id="menu">
    <OBJECT data="m1.gif" type="image/gif" usemap="#map1" border=0>
    <MAP name="map1">
    <AREA HREF="#/" COORDS="0,0,50, 14" onMouseOver="Op tion1()">
    <AREA HREF="#/" COORDS="50,0,10 0,14" onMouseOver="Op tion2()">
    ....
    </MAP></OBJECT>
    </div>

    I think you get the idea...
    This seems very easy to do but it's not, believe me.
    Any ideas? Thanks in advance!

  • Darren

    #2
    Re: Changing menu image


    <bzi999@gmail.c om> wrote in message
    news:1124103673 .982419.280150@ g47g2000cwa.goo glegroups.com.. .[color=blue]
    > Hi!
    > I'm trying to create a javaxcript application that changes a image menu
    > by following the mouse, something like:
    >
    > <!-- menu images are m1, m2, m3.gif-->
    > <script language="JavaS cript">
    > function option1()
    > { document.getEle mentById("menu" ).write("<img src=m1.gif>"); }
    > function option2()
    > { document.getEle mentById("menu" ).write("<img src=m2.gif>"); }
    > ...</script>
    >
    > <div id="menu">
    > <OBJECT data="m1.gif" type="image/gif" usemap="#map1" border=0>
    > <MAP name="map1">
    > <AREA HREF="#/" COORDS="0,0,50, 14" onMouseOver="Op tion1()">
    > <AREA HREF="#/" COORDS="50,0,10 0,14" onMouseOver="Op tion2()">
    > ...
    > </MAP></OBJECT>
    > </div>
    >
    > I think you get the idea...
    > This seems very easy to do but it's not, believe me.
    > Any ideas? Thanks in advance![/color]

    Not sure what you're after exactly but at a guess i would think you need a
    placeholder and change its href.
    [color=blue]
    >[/color]


    Comment

    • Darren

      #3
      Re: Changing menu image


      <bzi999@gmail.c om> wrote in message
      news:1124103673 .982419.280150@ g47g2000cwa.goo glegroups.com.. .[color=blue]
      > Hi!
      > I'm trying to create a javaxcript application that changes a image menu
      > by following the mouse, something like:
      >
      > <!-- menu images are m1, m2, m3.gif-->
      > <script language="JavaS cript">
      > function option1()
      > { document.getEle mentById("menu" ).write("<img src=m1.gif>"); }
      > function option2()
      > { document.getEle mentById("menu" ).write("<img src=m2.gif>"); }
      > ...</script>
      >
      > <div id="menu">
      > <OBJECT data="m1.gif" type="image/gif" usemap="#map1" border=0>
      > <MAP name="map1">
      > <AREA HREF="#/" COORDS="0,0,50, 14" onMouseOver="Op tion1()">
      > <AREA HREF="#/" COORDS="50,0,10 0,14" onMouseOver="Op tion2()">
      > ...
      > </MAP></OBJECT>
      > </div>
      >
      > I think you get the idea...
      > This seems very easy to do but it's not, believe me.
      > Any ideas? Thanks in advance!
      >[/color]

      This might help
      Founded in 1997, DEVShed is the perfect place for web developers to learn, share their work, and build upon the ideas of others.



      Comment

      • ASM

        #4
        Re: Changing menu image

        bzi999@gmail.co m wrote:[color=blue]
        > Hi!
        > I'm trying to create a javaxcript application that changes a image menu
        > by following the mouse, something like:
        >
        > <!-- menu images are m1, m2, m3.gif-->
        > <script language="JavaS cript">
        > function option1()
        > { document.getEle mentById("menu" ).write("<img src=m1.gif>"); }[/color]

        document.getEle mentById('menu' ).getElementsBy TagName('OBJECT ')[0].src='m1.gif';



        but it is a bad idea as 'm1.gif' not yet downloaded on mouse over

        about an alternative ?
        change apparence of image by css preloading ?


        with some words in french... but without them I think it's clear
        [color=blue]
        > <div id="menu">
        > <OBJECT data="m1.gif" type="image/gif" usemap="#map1" border=0>
        > <MAP name="map1">
        > <AREA HREF="#/" COORDS="0,0,50, 14" onMouseOver="Op tion1()">
        > <AREA HREF="#/" COORDS="50,0,10 0,14" onMouseOver="Op tion2()">
        > ...
        > </MAP></OBJECT>
        > </div>[/color]


        --
        Stephane Moriaux et son [moins] vieux Mac

        Comment

        Working...