[thelist] javascript help

Pamela R pampam12 at hotmail.com
Thu Oct 11 14:53:05 CDT 2001


you've convinced me ;)   thank you to everyone for their help!
Pam


>From: ".jeff" <jeff at members.evolt.org>
>Reply-To: thelist at lists.evolt.org
>To: <thelist at lists.evolt.org>
>Subject: RE: [thelist] javascript help
>Date: Thu, 11 Oct 2001 11:34:52 -0700
>
>pamela,
>
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > From: Pamela R
> >
> > 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?
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
>well, you've got a good start calling the focus() method after opening the
>window.  however, rather than detecting the browser before calling it, why
>not just test for support of that method?  that way it will fire in all
>browsers that support the focus() method on the window object rather than
>just netscape.  this is important to do, btw because nn2 does not support
>the focus() method on the window object.  so, the way you're doing it now
>could still throw an error for some users.
>
>change it to this:
>
><script language="JavaScript" type="text/javascript">
><!--
>   var popUpWin = null;
>
>   function openWindow(url)
>   {
>     features = 'menubar,resizable,height=300,width=400';
>     popUpWin = window.open(url, 'NewWindow', features);
>     if(popUpWin.focus) popUpWin.focus();
>   }
>// -->
></script>
>
>notice that i've not included a whole bunch of the settings for the third
>argument of the open() method.  that's because including any single setting
>automatically sets any left out as off by default.  this greatly shortens
>the amount of typing and the length of the string.
>
>read the following for more detail on how this works:
>http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/open_0.asp
>
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
> > <a href="javascript:openWindow('GRAPH1.html')"
> > >THERE'S ONLY ONE MAGAZINE DEVOTED EXCLUSIVELY TO
> >  THE PRODUCER MARKET</a>
> ><><><><><><><><><><><><><><><><><><><><><><><><><><><><><
>
>no offense, but popup window links done this way drive me batty.  if i'm 
>not
>paying close attention to the status bar when i mouseover the link i might
>miss the fact that javascript is being used instead of a standard link.
>shift-clicking the link will give me a window with a javascript error.  or,
>if i'm a non-js users i can't get to the content.  it doesn't have to be
>this way.
>
>move the call to the openWindow() function to the onclick event handler.
>add a return false statement after the call to the openWindow() function.
>move the document name from the openWindow() function to the href attribute
>like a normal link.  in it's place as the first argument of the 
>openWindow()
>function use "this.href" (without the quotes).  this is a special 
>javascript
>word which refers to the object being called, in this case the <a> tag.  
>so,
>this.href is referring to the href attribute of the current <a> object.
>
><a
>  href="graph1.html"
>  onClick="openWindow(this.href); return false"
> >THERE'S ONLY ONE MAGAZINE DEVOTED EXCLUSIVELY TO THE PRODUCER MARKET</a>
>
>i've read some of the suggestions to put "self.focus()" or "window.focus()"
>in the onload event handler of each of the documents that will be opened in
>the popup window.  that's a lot of work though and not necessary.  however,
>if you decide to go that route, make sure to remove the call to the focus()
>method from the openWindow() function or you'll get errors in win/ie5+.
>
>good luck,
>
>.jeff
>
>http://evolt.org/
>jeff at members.evolt.org
>http://members.evolt.org/jeff/
>
>
>
>---------------------------------------
>For unsubscribe and other options, including
>the Tip Harvester and archive of TheList go to:
>http://lists.evolt.org Workers of the Web, evolt !


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp





More information about the thelist mailing list