[thelist] Re: javascript help
Kim Bonfils
mail at bonfils.com
Fri Oct 12 07:41:48 CDT 2001
>Message: 29
>From: "Pamela R" <pampam12 at hotmail.com>
>To: thelist at lists.evolt.org
>Date: Thu, 11 Oct 2001 12:50:56 -0400
>Subject: [thelist] javascript help
>Reply-To: thelist at lists.evolt.org
>
>Hi all, I need some help with javascript. This looks like it'd be easy,
>but my brain isn't coming up with an answer today!
>
>I have a few graphs that need to pop up in their own sized window. The
>problem is that if you click on more than one in succession, without closing
>each one as you go - the graphs pop up into the same window, but the window
>ends up in the background. Then the user thinks that the link is not
>working. Can someone tell me how I would keep the window popping up in
>front, so the user can see it?
>
>thanks.
>
>Here's the scripting -
><script language="JavaScript"><!--
>function openWindow(url) {
>
>popUpWin=window.open(url,'NewWindow','toolbar=0,location=no,directories=0,status=0,menbar=1,scrollbars=0,resizable=1,width=400,height=300');
>
> if (navigator.appName == 'Netscape') {
> popUpWin.focus();
> }
>}
>// -->
> </script>
>
>And then for each graph:
>
><a href="javascript:openWindow('GRAPH1.html')">THERE'S ONLY ONE
> MAGAZINE DEVOTED EXCLUSIVELY TO THE PRODUCER MARKET</a>
Hm. Dunno what's wrong with your code, but I got this to work on my cv site
(http://www.bonfils.com/cv/sites.php?lang=eng, if you want to see it in
action). There's a bug in IE that makes it a good idea to check whether the
window exists.
<script language="JavaScript">
function popUrl(url)
{
if (newWindow==null || newWindow.closed)
{
newWindow=window.open(url,"popUpWindow","toolbar=yes,location=yes,status=yes,width=800,height=600,resizable=no");
}
else
{
newWindow.location=url;
}
newWindow.focus();
}
var newWindow=null;
</script>
Opening each window with <a href="javascript:popUrl([inset_url_here]);>Link</a>
Hope this helps
Kim Bonfils
http://kim.bonfils.com
More information about the thelist
mailing list