Hi,
I am looking to figure out what I need to modify to get a script working for a HTML based website.
What I want to accomplish is to click on a menu button such as the Home button as seen below and keep the onmousedown state when viewing any content part of the home page. For example, if a login page branches off of the home page, the home button should still be active. Another example is if I am in the Contact page and click a side panel link called contact details that opens a new page, the contact menu button should still have the onmousedown image, until another main menu item is clicked.
<a href="index.htm"><img src="images/home_up.gif" alt="" border="0" onmousedown="src='images/home_down.gif'" onmouseover="src='images/home_over.gif'" onmouseout=
"src='images/home_up.gif'"></a>
There are 7 different menu options that reflect the same formatting as above.
I used thread216-1620 as a reference point, however, I am unsure why the code is not functioning.
I made some slight changes, but nothing seems to work...and not sure if the <body onload...> is correct.
Javascript:
var clicked;
var name;
image1= new Image();
image1.src = "images/home_up.gif";
image1x= new Image()
image1x.src = "images/home_up.gif";
image1on = new Image();
image1on.src = "images/home_over.gif";
image1clik = new Image();
image1clik.src = "images/home_down.gif";
function on(number)
{
if(clicked == number)
{
}
else
{
name = "image" + number
document[name].src = eval(name + "on.src");
}
}
function off(number)
if(clicked == number)
{
}
else
{
name = "image" + number
document[name].src = eval(name + ".src");
}
}
function clikfn(name)
{
document[name].src = eval(name + "clik.src");
}
HTML format for each menu item:
</html>
<body onload="click('image1')">
....
<span>
<a href="index.htm"><img src="images/home_up.gif" alt="" border="0" onmousedown="clicked=1; clickfn('image1');" onmouseover="on(1);" onmouseout="off(1);"></a></span>
If there is more info I can provide please don't hesitate.
Thanks to all who can assist in my blunder.
David B
I am looking to figure out what I need to modify to get a script working for a HTML based website.
What I want to accomplish is to click on a menu button such as the Home button as seen below and keep the onmousedown state when viewing any content part of the home page. For example, if a login page branches off of the home page, the home button should still be active. Another example is if I am in the Contact page and click a side panel link called contact details that opens a new page, the contact menu button should still have the onmousedown image, until another main menu item is clicked.
<a href="index.htm"><img src="images/home_up.gif" alt="" border="0" onmousedown="src='images/home_down.gif'" onmouseover="src='images/home_over.gif'" onmouseout=
"src='images/home_up.gif'"></a>
There are 7 different menu options that reflect the same formatting as above.
I used thread216-1620 as a reference point, however, I am unsure why the code is not functioning.
I made some slight changes, but nothing seems to work...and not sure if the <body onload...> is correct.
Javascript:
var clicked;
var name;
image1= new Image();
image1.src = "images/home_up.gif";
image1x= new Image()
image1x.src = "images/home_up.gif";
image1on = new Image();
image1on.src = "images/home_over.gif";
image1clik = new Image();
image1clik.src = "images/home_down.gif";
function on(number)
{
if(clicked == number)
{
}
else
{
name = "image" + number
document[name].src = eval(name + "on.src");
}
}
function off(number)
if(clicked == number)
{
}
else
{
name = "image" + number
document[name].src = eval(name + ".src");
}
}
function clikfn(name)
{
document[name].src = eval(name + "clik.src");
}
HTML format for each menu item:
</html>
<body onload="click('image1')">
....
<span>
<a href="index.htm"><img src="images/home_up.gif" alt="" border="0" onmousedown="clicked=1; clickfn('image1');" onmouseover="on(1);" onmouseout="off(1);"></a></span>
If there is more info I can provide please don't hesitate.
Thanks to all who can assist in my blunder.
David B