Changing Menu Items Through JavaScript

Please note that official support for this menu version has now ceased. There are still plenty of users, though, and the forum is still running. Some of our long-time users may be able to help you out.
Post Reply
paulie100
Beginner
Beginner
Posts: 3
Joined: Tue Jan 14, 2003 7:02 pm

Changing Menu Items Through JavaScript

Post by paulie100 » Tue Jan 14, 2003 8:48 pm

Hi there,

I've just started looking into this menu system, and it is wonderful so far. One question that has come up for me is: Can menu items be changed dynamically, and if so, how? I'm for now thinking very simply, such as just changing the text of the menu item. For example, for a message board, the menu item might say "Boards", but I want to change it to say "Boards-NEW" or put a "New" icon there if a new message is posted while this user is online (this would be detected through php/mysql). So in php, I guess I'd like to code something like:

<?php
if ($newmessages) {?>
<script type=javascript>
****js code to change the menu text here. Is there a class function or variable defined in the menu code that makes this easy? could be simple as an assignment statement***
</script>
<?php
}
?>

It seems like this is likely to be easy, I just don't know the correct data element among all those arrays to reference and change. Also, assuming this is possible, would this update the menu text immediately, or would the menu have to be reloaded?

Thanks!
Paul M.

paulie100
Beginner
Beginner
Posts: 3
Joined: Tue Jan 14, 2003 7:02 pm

More clear...

Post by paulie100 » Tue Jan 14, 2003 10:11 pm

Woops, I should've been more clear in my message above. I am using the menu in frames. If I weren't, I think what I ask would be easy because I could just create a simple javascript variable with the text I want (prior to the menu scripts being called), and put that variable in the array files instead of straight text.

But, what I want to do is change menu text for a menu in another frame, hopefully without having to refresh that frame.

Thanks again.
Paul M.

Post Reply