[javascript] Open Popup window using javascript

I am looking to open one aspx page (test.aspx) in two different popup windows at the same time.

what I have till now second replace first one and page recreate in first.

I think it require more clarification here so,

Basicaly I create a graph and place it in test.aspx, and save that graph as image file. I put a button on test.aspx which linked with stimulsoft report and that report show pdf format of that image. Now if i open with test.aspx it replace the image page. but I want to see both graph and pdf same time. One solution is I create a new blank aspx page to display report but I try avoid to add new page because it is possible to mount report on test.aspx.

The question is just to open a single POPUP window twice on same time, but may be it is posible or not. and each and every popup containing there own dynamic controls and report like mrt.

This question is related to javascript

The answer is


First point is- showing multiple popups is not desirable in terms of usability.

But you can achieve it by using multiple popup names

var newwindow;
function createPop(url, name)
{    
   newwindow=window.open(url,name,'width=560,height=340,toolbar=0,menubar=0,location=0');  
   if (window.focus) {newwindow.focus()}
}

Better approach will be showing both in a single page in two different iFrames or Divs.

Update:

So I will suggest to create a new tab in the test.aspx page to show the report, instead of replacing the image content and placing the pdf.


To create a popup you'll need the following script:

<script language="javascript" type="text/javascript">

function popitup(url) {
newwindow=window.open(url,'name','height=200,width=150');
if (window.focus) {newwindow.focus()}
return false;
}


</script>

Then, you link to it by:

  <a href="popupex.html" onclick="return popitup('popupex.html')">Link to popup</a>

If you want you can call the function directly from document.ready also. Or maybe from another function.