PDA

View Full Version : New Window Help


mbock11
09-22-2004, 09:55 PM
I am trying to open a new window using Javascript from an onclick event. I have a radio button and I want a window to open as the user clicks on it. Here is my javascript code:

function WinCPReport()
{

mywindow = window.open("CPReport.asp","Your Selections","height=200,width=200,scroll=no,status=no,toolbar=no");
mywindow.moveTo(150,150);

}

I keep getting errors on the page that say "Invalid Argument". When I make the code look like this it will work:

function WinCPReport()
{

mywindow = window.open("CPReport.asp");
mywindow.moveTo(150,150);

}

The problem is that I need to name the window and I want all the other properties in there.
Can someone please help me out?

Roy Sinclair
09-22-2004, 10:26 PM
Perhaps removing the space between the "n" and the "o" after "toolbar=" will fix the problem.

glenngv
09-23-2004, 02:20 AM
Perhaps removing the space between the "n" and the "o" after "toolbar=" will fix the problem.
I don't think that is the problem as this forum just split that up (http://www.codingforums.com/showthread.php?t=44550). The problem is in the target parameter (2nd parameter) of the window.open statement. It doesn't allow special characters in the target. Only the underscore is allowed. So removing the space or putting underscore is the solution.

var mywindow = window.open("CPReport.asp", "Your_Selections","height=200, width=200, left=150, top=150, scrollbars=no, status=no, toolbar=no");
mywindow.focus();

mbock11
09-23-2004, 08:32 PM
Thanks Glenn it worked!