pathfinder
08-23-2002, 04:17 PM
Hi,
I have been searching high and low for a solution for a problem that I ran into. I am currently using the following script to drive a menu on the side of my page:
<SCRIPT language=javascript>
function ChangeFont(what,color) {
what.style.fontColor=color;
}
function ChangeBackground(what, color) {
what.style.backgroundColor=color;
}
function MouseOverMenu(what){
what.style.cursor='hand';
ChangeBackground(what, "#CCCC66");}
function MouseOutMenu(what){
what.style.cursor='default';
ChangeBackground(what, "#669966");
}
function Click_URL(url) {
location.href = url
}
</SCRIPT>
The script is attached to this menu:
<table cellspacing=1 cellpadding=1 width=135 border=0>
<tbody>
<tr>
<td class=menuItemSide width=8 height=25></td>
<td class=menuItem onMouseOver=javascript:MouseOverMenu(this); onClick="javascript:Click_URL('index.asp')"; onMouseOut=javascript:MouseOutMenu(this); height=25> Employers Home</td>
</tr>
<tr>
<td class=menuItem width=8 height=25></td>
<td class=menuItem onMouseOver=javascript:MouseOverMenu(this); onClick="javascript:Click_URL('advantages.asp')"; onMouseOut=javascript:MouseOutMenu(this); height=25> Why work with us?</td>
</tr>
<tr>
<td><img height=0 src="../images/pix.gif" width=8 border=0></td>
<td><img height=0 src="../images/pix.gif" width=127 border=0></td>
</tr>
</tbody>
</table>
Here is the question...I want move the menu into a separate file and use it as an include, so I can gain the obvious advantages...but cannot do it now because the first <td> tag calls a style of either menuItemSide, if it is the page that is currently being viewed, or menuItem if it is not active.
Is there a way that I can dynamically change the style based on the page that is currently being viewed? In the above code, if we were to load the advantages page, the <td> would be assigned the MenuItemSide style, and the style would revert to the default MenuItem for the page that we just left in the newly loaded page?
Thanks in advance for any thoughts or help!
:confused:
I have been searching high and low for a solution for a problem that I ran into. I am currently using the following script to drive a menu on the side of my page:
<SCRIPT language=javascript>
function ChangeFont(what,color) {
what.style.fontColor=color;
}
function ChangeBackground(what, color) {
what.style.backgroundColor=color;
}
function MouseOverMenu(what){
what.style.cursor='hand';
ChangeBackground(what, "#CCCC66");}
function MouseOutMenu(what){
what.style.cursor='default';
ChangeBackground(what, "#669966");
}
function Click_URL(url) {
location.href = url
}
</SCRIPT>
The script is attached to this menu:
<table cellspacing=1 cellpadding=1 width=135 border=0>
<tbody>
<tr>
<td class=menuItemSide width=8 height=25></td>
<td class=menuItem onMouseOver=javascript:MouseOverMenu(this); onClick="javascript:Click_URL('index.asp')"; onMouseOut=javascript:MouseOutMenu(this); height=25> Employers Home</td>
</tr>
<tr>
<td class=menuItem width=8 height=25></td>
<td class=menuItem onMouseOver=javascript:MouseOverMenu(this); onClick="javascript:Click_URL('advantages.asp')"; onMouseOut=javascript:MouseOutMenu(this); height=25> Why work with us?</td>
</tr>
<tr>
<td><img height=0 src="../images/pix.gif" width=8 border=0></td>
<td><img height=0 src="../images/pix.gif" width=127 border=0></td>
</tr>
</tbody>
</table>
Here is the question...I want move the menu into a separate file and use it as an include, so I can gain the obvious advantages...but cannot do it now because the first <td> tag calls a style of either menuItemSide, if it is the page that is currently being viewed, or menuItem if it is not active.
Is there a way that I can dynamically change the style based on the page that is currently being viewed? In the above code, if we were to load the advantages page, the <td> would be assigned the MenuItemSide style, and the style would revert to the default MenuItem for the page that we just left in the newly loaded page?
Thanks in advance for any thoughts or help!
:confused: