hpbauer
Member
Posts: 12
Registered: 7/2/2004
Member Is Offline
|
| posted on 7/12/2004 at 08:40 AM |
|
|
selected menu entry is not displayed bold
Hi,
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':
alert(document.getElementById(...).style.fontWeight);
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,
PETRE
|
|
|
rock
Moderator
Posts: 687
Registered: 4/15/2003
Member Is Offline
|
| posted on 7/12/2004 at 09:36 AM |
|
|
Test following:
alert(document.getElementById(...).innerHTML);
should return corect item's content(image and caption);
|
|
|
hpbauer
Member
Posts: 12
Registered: 7/2/2004
Member Is Offline
|
| posted on 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...
hpbauer has attached this image:
|
|
|
rock
Moderator
Posts: 687
Registered: 4/15/2003
Member Is Offline
|
| posted on 7/12/2004 at 09:49 AM |
|
|
So probably you working with item (item id - this.n_id) not one you expected to.
|
|
|
hpbauer
Member
Posts: 12
Registered: 7/2/2004
Member Is Offline
|
| posted on 7/12/2004 at 10:18 AM |
|
|
sorry, but I do not understand your last answer. What do you mean wíth "item(item id - this.n_id)"?
How could it happen that I got the wrong elementID?
Great service - your fast replies :)
|
|
|
rock
Moderator
Posts: 687
Registered: 4/15/2003
Member Is Offline
|
| posted on 7/12/2004 at 10:37 AM |
|
|
Try to call:
alert(this.a_config[0]);
alert(this.o_root.a_index[this.n_id].a_config[0]);
all should return correct caption of the item.
If caption is correct then the reason probably in changes I can not assume.
|
|
|
hpbauer
Member
Posts: 12
Registered: 7/2/2004
Member Is Offline
|
| posted on 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
Member
Posts: 12
Registered: 7/2/2004
Member Is Offline
|
| posted on 7/12/2004 at 12:51 PM |
|
|
Problem solved !!!
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,...
Greetings,
Peter
|
|
|