[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

javascript popup problem

Posted on 2006-07-04
4
Medium Priority
?
450 Views
Last Modified: 2010-05-18
My javascript is not great.

I use this to open a window

function popup(url, dimensions)
{
      newwindow=window.open(url,'name', dimensions);
      if (window.focus) {newwindow.focus()}
}

with the links

<a href="javascript:popup('delivery&returns.php', 'height=450,width=270');">delivery&returns </a> |

<a href="javascript:popup('contact.php', 'height=300,width=350');">contact</a>


The problem is if I click on one then another the new page is put in the 'old' window wich is the wrong dimensions. any ideas?

Ross
0
Comment
Question by:roscoeh23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 17037047
Hi roscoeh23,

You have to change the 'name' for each popup, otherwise the same named window will be reused.

function popup(url, dimensions,what)
{
     newwindow=window.open(url,what, dimensions);
     if (window.focus) {newwindow.focus()}
}

with the links

<a href="javascript:popup('delivery&returns.php', 'height=450,width=270','big');">delivery&returns </a> |

<a href="javascript:popup('contact.php', 'height=300,width=350','small');">contact</a>


Tim Cottee
0
 
LVL 1

Accepted Solution

by:
dnlakhani earned 2000 total points
ID: 17040187
<script>
function popup(url, dimensions,name)
{
     newwindow=window.open(url,dimensions,name);
     if (window.focus) {newwindow.focus()}
}
</script>

change the name for different window

<a href="javascript:popup('delivery&returns.php', 'height=450,width=270','test');">delivery&returns </a> |

<a href="javascript:popup('contact.php', 'height=300,width=350','test11');">contact</a>
0
 

Expert Comment

by:Tahir_Imran
ID: 17071422
THis will always work for you :
function popup(url, dimensions,what)
{
    day = new Date();
    id = day.getTime();
  newwindow=window.open(url,id, dimensions);
}

with the links

<a href="javascript:popup('delivery&returns.php', 'height=450,width=270','big');">delivery&returns </a> |

<a href="javascript:popup('contact.php', 'height=300,width=350','small');">contact</a>
0
 

Expert Comment

by:Tahir_Imran
ID: 17071430
a Sight modification , No need to pass what
THis will always work for you :
function popup(url, dimensions)
{
    day = new Date();
    id = day.getTime();
  newwindow=window.open(url,id, dimensions);
}

with the links

<a href="javascript:popup('delivery&returns.php', 'height=450,width=270');">delivery&returns </a> |

<a href="javascript:popup('contact.php', 'height=300,width=350');">contact</a>
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question