Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:29

Calling Java functions as menuitems

Poster: realphp
Dated: Thursday October 13 2005 - 0:52:37 BST

Hi Milonic,

Great menu system :o

Im curious about the best way to deal with using advanced javascript functions, such as a popup window for example called via the menu.

This is the code to our chatroom. When a user clicks the chat button it calls a javascript routine that calculates the users screen resolution then pops a centered window and loads the chatroom in it.

<a href="/chat/login.php" onclick="chatroom(this.href,'chat','620','540','yes','center');return false" onfocus="this.blur()">Chatroom</a>

<script language="javascript" type="text/javascript">
var win=null;
function chatroom(mypage,myname,w,h,scroll,pos){
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=0}

I tried to add the function call as a menu item but it didnt work, any idea where I went wrong?

aI("text=Chatroom;url=chat/login.php" onclick="chatroom(this.href,'chat','620','540','yes','center');return false" onfocus="this.blur()">Chatroom");

Deep thought...
What if I wanted to add a javascript menu item down the road? well okay so I add the menu item that calls the function, thats fine, but where do I put the function itself? I cant imagine that I need to add it to every single page, that would be a nightmare, we have over 300 pages and some are dynamically created, so if can we grab it when the menu loads, instead of when the page loads? This would be idea since the menu is shared with all pages.

Well If I can have some thoughts, on this please and thank you


Poster: Shap5202
Dated: Tuesday October 18 2005 - 15:26:23 BST

You could try this.


That would create a menu item with the Text of 'Chatroom' and call the chatroom javascript function when it is clicked.