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:28

How to code button item to close window


Poster: rudy
Dated: Monday October 1 2007 - 2:02:46 BST

I have a menu item named "Logout" and would like to know how to code this so it just closes the page that the menu is on, not link to another page.

I thought this was the javascript code but I must have something wrong - it doesn't work.

Code:
aI("text=Logout;oncolor=#FF0000;offcolor=#000000;URL=javascript:myfunction('window.close');")

Re: How to code button item to close window


Poster: Ruth
Dated: Saturday October 6 2007 - 5:01:28 BST

Hi Rudy,

Well, I tried this, even tried actually creating the function and like you couldn't get it to work, even if the function is at the top of the data file and also on the page itself. I did find a way to get it to work, but couldn't test it in anything but IE and an old FF. It worked in IE not in the old FF which gave me ' Scripts may not close windows that were not opened by script.' So, I'll give you want I have and you can test in newer versions. This is set up in the download menu so it uses the colors from that for the 'class' I set up.

Code:
aI("text=<form><input type=button class=button value='Logout' onclick=window.close() /></form>;type=form;");

and the class is

Code:
.button{background-color:#eeeeee;font-size:10px;width:50;border-width:0px;cursor:hand;}


It doesn't really look like a button because of the class i created. Other than that, I think you'll have to contact Milonic about how to do this.

Ruth