use of onclick event in menu item for popup page

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
scottb
Beginner
Beginner
Posts: 2
Joined: Mon Apr 13, 2009 4:02 am

use of onclick event in menu item for popup page

Post by scottb »

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
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

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

Post by Ruth »

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: Select all

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: Select all

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
scottb
Beginner
Beginner
Posts: 2
Joined: Mon Apr 13, 2009 4:02 am

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

Post by scottb »

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
Post Reply