Forum Moderators: open
I ave a css/javascript expanding tree menu that is worlking fine under normal circumstances.
The js is shown below:
if (!document.getElementById)
document.getElementById = function() { return null; }
function initializeMenu(menuId, mainnavId) {
var menu = document.getElementById(menuId);
var mainnav = document.getElementById(mainnavId);
if (menu == null ¦¦ mainnav == null) return;
mainnav.parentNode.style.backgroundImage = "url(../images/plus.gif)";
mainnav.onclick = function() {
var display = menu.style.display;
this.parentNode.style.backgroundImage =
(display == "block")? "url(../images/plus.gif)" : "url(../images/minus.gif)";
menu.style.display = (display == "block")? "none" : "block";
return false;
}
}
And to make sure that the '+' and '-' gifs anr displayes just once per <li> I use the following css line:
background: no-repeat 0em 0.5em;
My problem is that if the user is viewing in a non css enviroment the 'no-repeat' is lost and the whole menu is unusable because the gifs repeat and thus obscure the contents on the menu.
Is there any way of specifying the 'no-repeat' in the javascript?
Thnaks all.