Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10

Thread: pop up menu

  1. #1
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question pop up menu

    i want to do a pop up menu where there are 3 options and whatever option is selected the image should change.

    i have managed to do the pop up menu but i dunno the bit where it needs to change the image.

    i have checked the current codes but they give link to other pages when an option is selected where i want to swap an image.

    does anyone knows how to do this?

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You need to use innerHTML to change the image without reloading the page..
    something like this

    define your origional image like this

    <span name='dude'><img src='joe.gif'></img></span>

    then use your select to change the image

    dude.innerHTML='<img src='fred.gif'></img>'
    Animation Rule #64
    Poor quality images are often artistic,
    Poor quality sound is ALWAYS annoying.

  • #3
    New Coder
    Join Date
    Nov 2002
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Why not...

    <span id='dude'><img src='joe.gif'></span>

    then use your select to change the image

    document.getElementById("dude").innerHTML='<img src='fred.gif'>';

    More Cross-Browser...
    &#187; &#240;, Ŵħąŧ&#191; &#221;őų łįķę&#191;

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i dont like to make my browser cross hahaha
    Thanks Tempest1
    Animation Rule #64
    Poor quality images are often artistic,
    Poor quality sound is ALWAYS annoying.

  • #5
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    well my pop up menu is done by js, i didn't really understand y i should use inner html in js.

    can u pls give me an example with full js code so that i can understand better?

    thanx

  • #6
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    i think u got me wrong. by pop up menu i meant the one when u right click on an image the menu opens and there u have options.once u choose an option it'll change the image and when u click another option it'll change the image as well.

    it's not a list menu that we can see in the forms it's a js pop up menu.

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    For that I think you'll need to supply the code you are currently using.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #8
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <script language="JavaScript" type="text/JavaScript">function mmLoadMenus() {
    if (window.mm_menu_0115002607_0) return;
    window.mm_menu_0115002607_0 = new Menu("root",32,18,"",12,"#000000","#FFFFFF","#CCCCCC","#000084","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);
    mm_menu_0115002607_0.addMenuItem("a");
    mm_menu_0115002607_0.addMenuItem("b",);
    mm_menu_0115002607_0.hideOnMouseOut=true;
    mm_menu_0115002607_0.bgColor='#555555';
    mm_menu_0115002607_0.menuBorder=1;
    mm_menu_0115002607_0.menuLiteBgColor='#FFFFFF';
    mm_menu_0115002607_0.menuBorderBgColor='#777777';

    mm_menu_0115002607_0.writeMenus();
    }


    in the body:

    <body>
    <script language="JavaScript1.2">mmLoadMenus();</script>
    <div id="Layer1" style="position:absolute; left:363px; top:229px; width:104px; height:83px; z-index:1"><a href="javascript:;" onMouseOver="MM_showMenu(window.mm_menu_0115002607_0,126,81,null,'image1')" onMouseOut="MM_startTimeout();"><img src="v.gif" name="image1" width="129" height="84" border="0" id="image1"></a></div>
    </body>


    in this code i want when the user choses a option the image 1 will change from x.gif to y.gif

    and if the user chooses option b the image 1 changes from x.gif to m.gif


    ANy ideas how to do this?

  • #9
    Regular Coder
    Join Date
    Jun 2002
    Location
    Australia
    Posts
    197
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I still reckon
    you should try innerHTML
    ok you have defined your image (without the closing tag </img>) so i pu that in .. chuck it all in a span and
    <span id='blah'><img src="v.gif" name="image1" width="129" height="84" border="0" id="image1"></img></span>

    onMouseOver="change_image();MM_showMenu(window.mm_menu_0115002607_0,126,81,null,'image1')"

    function change_image()
    {
    blah.innerHTML='<img src="y.gif" name="image1" width="129" height="84" border="0" id="image1"></img>'
    }

    something like that should work .. innerHTML doesnt care what menu or object event you use to call the function change_image..
    hope this helps
    ez

    If that doesnt work you could try outerHTML to change the entire Layer1 definition..
    Animation Rule #64
    Poor quality images are often artistic,
    Poor quality sound is ALWAYS annoying.

  • #10
    Regular Coder
    Join Date
    Jan 2003
    Posts
    148
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    i have sorted it out now i have another problem that the images next to a particular image covers my menus,,, i have been using layers in dreamweaver if that helps...

    thanx 4 the help but what shall i do now???


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •