Wrox Programmer Forums
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 23rd, 2005, 01:17 PM
Authorized User
 
Join Date: Sep 2004
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default Popup Menu

I use
Code:
window.CreatePopup
to create a popup menu, which when users click items on the popup menu, I would execute a javascript function,
Code:
oPopup.document.body.innerHTML = "<a href='#' onclick='javascript:OpenWin(rptName);'>Test Item</a>";
to do a window.open of a spreadsheet.

But it kept giving my object expected error, and I suspect it has something to do with 'OpenWin' function?!

The OpenWin looks like this:

Code:
function openwin(rptName)
{
    var win= window.open(RptName,null,"width=1000, height=550,top=10,left=10,toolbar=1, status=1, resizable=1, location=1"); 
}
Can someone help, please?
 
Old June 24th, 2005, 02:55 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

It's probably case sensitivity - you are calling OpenWin(), but your function is called openwin()

HTH,

Chris

 
Old June 24th, 2005, 07:21 AM
Authorized User
 
Join Date: Sep 2004
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the reply.

I did make sure all cases are correct. So it shouldn't be the case issue.
Somewhere I read about making calls from a popup menu to functions in the parent window. It seems to me that I need to somehow hide the popup first and then call the parent.function. But I don't how to do this?!

Any idea?

 
Old June 24th, 2005, 08:03 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Give this a try...
Code:
function showPopup(){
    var myPopup = window.createPopup();
    var d = myPopup.document;
    var link = d.body.appendChild(d.createElement("a"));
    link.appendChild(d.createTextNode("Test Item"));
    link.href = "#";
    link.onclick = new Function("openWin('http://www.google.co.uk'); return false");
    myPopup.show(30, 30, 100, 100);
}
function openWin(rptName){
    var win= window.open(rptName,null,"width=1000, height=550,top=10,left=10,toolbar=1, status=1, resizable=1, location=1"); 
}
Cheers,

Chris

 
Old June 24th, 2005, 12:46 PM
Authorized User
 
Join Date: Sep 2004
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, Chris,

I'll try that once I'm done with another emergency.

 
Old June 24th, 2005, 03:28 PM
Authorized User
 
Join Date: Sep 2004
Posts: 70
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the help, it does work for me. =)








Similar Threads
Thread Thread Starter Forum Replies Last Post
How to hide combo box behind the popup menu? mohini ASP.NET 1.x and 2.0 Application Design 4 March 22nd, 2006 12:22 AM
Popup Menu Help No. 2 tdaustin Javascript How-To 2 July 8th, 2004 07:11 PM
Cascading popup menu rodmcleay VB How-To 0 March 3rd, 2004 10:47 PM
Access' file popup menu Exodus Access VBA 2 December 29th, 2003 09:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.