How to make a popup window from this menu?

Discussion in 'JavaScript' started by Lotus9, Mar 14, 2007.

  1. #1
    Hey,

    Can someone please help me figure this out... how would I make one of these links on this dhtml menu create a controlled popup window like this:

    <a class="link5" href="" onclick="window.open('http://www.domain.com','popup',config='height=500,width=828,top=20,left=20,toolbar=no,menubar=no,scrollbars =yes,resizable=no,location=no,directories=no,status=no')">Privacy Policy</a>

    
    
    acemenu = new ACEMenu('5i1'); 
    acemenu.position = 'right'; 
    
    acemenu.AddItem('Terms Of Use', 'http://www.domain.com', '', false , '', '0', '0'); 
    acemenu.AddItem('Return Policy', 'http://www.domain.com', '', false , '', '0', '0'); 
    acemenu.AddItem('Shipping Policy', 'http://www.domain.com', '', false , '', '0', '0'); 
    acemenu.AddItem('Privacy Policy', 'http://www.domain.com', '', false , '', '0', '0');
    
    Code (markup):
     
    Lotus9, Mar 14, 2007 IP
  2. Lotus9

    Lotus9 Peon

    Messages:
    127
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Okay... I found something out... I can use this code to get links to open in new windows from the menu:

    acemenu.AddItem('Terms Of Use', 'your_page.htm" target="_blank" onclick="window.open(this.href, this.target);return false', '', false , '', '0', '0');

    But, when I try to control the size of the new window, by adding this... the entire dhtml menu disappears from the page!

    acemenu.AddItem('Terms Of Use', 'your_page.htm" target="_blank" onclick="window.open(this.href, this.target,'width=300,height=100,left=450,top=250,toolbar=yes');return false', '', false , '', '0', '0');

    Does anyone know why it's doing that... and a way to possibly fix it?

    Thanks.
     
    Lotus9, Mar 14, 2007 IP
  3. Aragorn

    Aragorn Peon

    Messages:
    1,491
    Likes Received:
    72
    Best Answers:
    1
    Trophy Points:
    0
    #3
    You have to escape the single quotes surrounding 'width=300,height=100,left=450,top=250,toolbar=yes'
    Try this
    acemenu.AddItem('Terms Of Use', '#" target="_blank" onclick="window.open(this.href, this.target,\'width=300,height=100,left=450,top=250,toolbar=yes\');return false', '', false , '', '0', '0');
    Code (markup):
     
    Aragorn, Mar 15, 2007 IP