Board Logo

selected menu entry is not displayed bold
hpbauer - 7/12/2004 at 08:40 AM

I customized the tree menu for my own needs. But now I noticed that the selected menu-entry is not displayed 'bold' anymore.

The according code can be found in the function item_select (b_deselect) at the line get_element('i_txt' + this.o_root.n_id + '_' + this.n_id).style.fontWeight = b_deselect ? 'normal' : 'bold';

I get a JavaScript Error, because the style-Attribut seems to be "null or undefined".
If I don't use the function get_element but use document.getElementById() instead, this JavaScript Error will be solved:
document.getElementById('i_txt' + this.o_root.n_id + '_' + this.n_id).style.fontWeight = b_deselect ? 'normal' : 'bold';

But the Element looks all the same. No bold text.

If i read out the fontWeight Attribute again it will be set correctly to 'bold':

If I set another style Attribute (e.g. display="none") this will have no consequences, too (but I can read it out again and it is set correctly).

The object I want to modifiy the css-Attribute for seems to exist, because
(document.getElementById(...)) ? alert("yes") : alert("no");
returns yes.

I made some modifcations on the code at other locations. So I cannot say since which modification this error appears. Can someone help me? Who has an idea what I could have made wrong?
Thanks a lot,

rock - 7/12/2004 at 09:36 AM

Test following:
should return corect item's content(image and caption);

hpbauer - 7/12/2004 at 09:45 AM

Good hint. There is the problem:
Here only comes the image (see attached file). But the label is missing. I have no idea...

rock - 7/12/2004 at 09:49 AM

So probably you working with item (item id - this.n_id) not one you expected to.

hpbauer - 7/12/2004 at 10:18 AM

sorry, but I do not understand your last answer. What do you mean wA?th "item(item id - this.n_id)"?
How could it happen that I got the wrong elementID?

Great service - your fast replies :)

rock - 7/12/2004 at 10:37 AM

Try to call:
all should return correct caption of the item.
If caption is correct then the reason probably in changes I can not assume.

hpbauer - 7/12/2004 at 10:42 AM

Thank you.
The object is the right one (alerts give the right message). So I have to search more.

hpbauer - 7/12/2004 at 12:51 PM

SOOOORRRY, I made a silly mistake.
I customized the output (=return of the item_init function). And the id we were talking about did exist two times. So it was no wonder,...

Back to forum: