Forum Moderators: open

Message Too Old, No Replies

how do i use a variable to set a mouse over layer option

need to set a variable by current month 2 set a mouse over option 4 a layer

         

chompy

6:36 pm on Nov 8, 2002 (gmt 0)

10+ Year Member



Hi can anyone advise please?

I have written this javascript see below with extraction of html where i want to use the variable (my first go at programming) to set a variable.
I want to use this variable in a 'mouse over' function on a layer. as you can see if the month is january ie '0' it sets varaible 'now' to layer 1.
Then if the mouse passes over an area in the html it calls the now variable to set which layer to show.

is this possible if so can anyone help explain or show me where to look to find out how to do it?

being simplistic and a non programmer i thought i could simply pop the variable into the html like this

onMouseOver="MM_showHideLayers('now','','show')">

BUT obviously not!

HELP!?! :-)

many thanks

<SCRIPT LANGUAGE="JavaScript">
<!--

var month =now.getMonth();

var monthname;

if(month==0) monthname= "layer1"
if(month==1) monthname= "layer2"
if(month==2) monthname= "layer3"
if(month==3) monthname= "layer4"
if(month==4) monthname= "layer5"
if(month==5) monthname= "layer6"
if(month==6) monthname= "layer7"
if(month==7) monthname= "layer8"
if(month==8) monthname= "layer9"
if(month==9) monthname= "layer1"
if(month==10) monthname= "layer1"
if(month==11) monthname= "layer1"

-->
</SCRIPT>

<p align="center"><img src="images/decor.gif" width="97" height="10"></p>
<p align="center"><img src="images/specialoffers2.gif" width="131" height="159"
onMouseDown="MM_showHideLayers('Layer4','','hide','Layer2','','hide','Layer3','','hide','Layer5',
'','hide','Layer1','','hide','Layer6','','hide','Layer7','','hide','Layer8','','hide','Layer9','','hide')"

onMouseOver="MM_showHideLayers('now','','show')"></p>
<p align="center"><img src="images/decor.gif" width="97" height="10"></p>

*blue text is all on one line

[edited by: tedster at 9:56 pm (utc) on Nov. 8, 2002]

moonbiter

7:50 pm on Nov 8, 2002 (gmt 0)

10+ Year Member



I think your variable would be
monthname
, not
now
. It's hard to tell without all of the code (I can't see where you are getting
now
from and I assume you left the function MM_showhideLayers out of your example code on purpose ...).