View Full Version : Multiple Popup Windows in Same Page

02-27-2009, 03:39 PM
I would be eternally grateful to the kind soul who can steer me right on this problem I am having. I have been researching it online for about half the day and can't seem to make it work.

I am designing a student resources webpage for my school. Each lesson has three parts: 1) A Video 2) A Study Sheet 3) A Quiz

I want the lessons to open in a Javascript Popup window. I have gotten them to open in a popup window but the problem is that each exercise simply replaces the previous in the window instead of opening a new window. What do I need to do to the code below so that each resource opens a seperate javascript window with a slightly different position on the page so as not to overlap completely.

This is the code that I have in the <head>

<script type="text/javascript">
function showPopup(url) {
if (window.focus) {newwindow.focus()}

This is the code in the <body>

<a href="Adjectives/AdjectivesExplanation/AdjectivesExplanation.html" onClick='showPopup(this.href); return(false);'>Adjective Video</a>

<a href="Adjectives/ComparativePowerPointVid/ComparativePowerPointVid.html" onClick='showPopup(this.href); return(false);'>Comparative Adjectives</a>

Thank you.


02-27-2009, 04:02 PM
That is because you are using the same name for your popups. Try the following

<script type="text/javascript">
function showPopup(url,option) {
var name='newwindow'+option;

if (window.focus) {newwindow.focus()}

<a href="Adjectives/AdjectivesExplanation/AdjectivesExplanation.html" onClick='showPopup(this.href,1); return(false);'>Adjective Video</a>

<a href="Adjectives/ComparativePowerPointVid/ComparativePowerPointVid.html" onClick='showPopup(this.href,2); return(false);'>Comparative Adjectives</a>

02-27-2009, 04:23 PM
Thanks a million!