...

View Full Version : pop up menu



pinkcat_02
01-14-2003, 02:36 AM
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?:rolleyes:

ez4ne12c
01-14-2003, 02:49 AM
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>'

tempest1
01-14-2003, 03:22 AM
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...

ez4ne12c
01-14-2003, 03:29 AM
i dont like to make my browser cross hahaha
Thanks Tempest1

pinkcat_02
01-14-2003, 06:20 PM
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

pinkcat_02
01-14-2003, 09:44 PM
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.:(

whammy
01-15-2003, 01:19 AM
For that I think you'll need to supply the code you are currently using. :eek:

pinkcat_02
01-15-2003, 02:19 AM
<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?

ez4ne12c
01-15-2003, 10:17 PM
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..

pinkcat_02
01-15-2003, 10:28 PM
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???:rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum