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

use of onclick event in menu item for popup page


Poster: scottb
Dated: Monday April 13 2009 - 4:20:31 BST

Greetings,

I have a page that I want to have as a js popup page accessible from the menu. The code I think I need is:

aI("text=CONTACT US;url=radio_archive/player_inc.php;
onclick="NewWindow(this.href,'name','500','525','yes');return false;");

but when I put this in the menu file the menu disappears. Do I need to add the js script to the menu page or something else or is this even possible?

Here is the js I use on the web pages to make the onclick event work:

var win = null;
function NewWindow(wizpage, wizname, w, h, scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings = 'height=' + h + ',width=' + w + ',top= 100,' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'
win = window.open(wizpage, wizname, settings)
}

Thanks,
Scott

Re: use of onclick event in menu item for popup page


Poster: Ruth
Dated: Monday April 13 2009 - 7:57:35 BST

Hi,

Well, I'm not a function person, so all I can do is give you one I actually have working so you can see it, and from that you should be able to figure out how to do yours :) The function goes in the top of the data file right below the sufOffsetLeft, menuclosedelay stuff


Code:
var newwindow;
function mynewwin(url)
{
   newwindow=window.open(url,'name','height=500,width=400,left=100,top=100,resizable=yes,scrollbars=yes,toolbar=yes,status=yes');
}


Then in the aI string, the code would be

Code:
aI("text=page in a new window;url=javascript:mynewwin('http://poems2u.com/');");


So when you click that link, it will open a page at 500x400px set at the left 100 and top 100, be resizable, have scrollbars, toolbar and status bar. You can put in any of the parameters for a browser window.

Maybe you can figure out how to do what you need with whatever that function you have is using this model. Post back if you need more help.

Ruth

Re: use of onclick event in menu item for popup page


Poster: scottb
Dated: Tuesday April 14 2009 - 2:43:19 BST

Ruth,

Thanks so much for the help. It worked perfectly! Not only are the menus the best I have used, but the support forums are great too. Thank you for taking the time to share your knowledge.

Best,
Scott