I currently have a problem with changing some style attributes of elements using JavaScript.
The website I am working on has a menu on the left side. The menu is a CSS-styled unordered list which has the fore- and background color defined in the CSS, as well as the border attribute. When a user clicks on a menu item, I would like the border to change to another color so he knows which page he is looking at. The site: http://www.maresweb.de/mwtest/
I tried to give an ID to a menu item and uses the onclick event to trigger a function which looks like this:
CODE
function changestyle(item)
{
document.getElementById(item).style.border = "1px solid #244c66";
}
{
document.getElementById(item).style.border = "1px solid #244c66";
}
However, nothing happens when clicking on the item. If I change the JS to
CODE
function changestyle(item)
{
document.getElementById(item).style.fontSize= "250%";
}
{
document.getElementById(item).style.fontSize= "250%";
}
it works as expected. Any ideas how I can modify the border and/or colors of the clicked button?
Regards,
Sebastian