My preexisting application that I'm trying to edit uses PHP / Javascript / XML and stylesheets to accomplih a big multilevel dropdown menu. The php reads each element of the xml file, based on what it is (opening or closing tag) writes html.
The problem is this开发者_开发技巧 all happens AFTER the tags and I need to style based on the looping level of the XML I know how to set the styles based on the loop, but I dont know how to print them because I have already printed the tags
The browser would have renederd them already
Does anyoen know how I can fix this?
PS...i cant use inline stlyes for this because the javascript and the html are linked...its gotta be external or local between style tags.
Would it be possible to add another node in the XML for holding the class info and then using that in the loop when constructing the menu? Probably easiest would be to find where it starts to write the menu, usually a <ul>
or whatever, and add a class or id there for the whole menu, and then do like
ul.class ul ul li
{
background-color:#FFFF00;
}
in the style sheet for how ever many child levels of the menu there are (ul.class ul ul li would be 2 child levels down)
精彩评论