Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open more than one small window at a time w/javascript

Status
Not open for further replies.

saw

Technical User
Oct 6, 2000
14
US
I have a web page in which one can click on an item and a small window opens to show info on that item, but when I try to click another item to compare with the first, it only fills the original window with the new item's info. How can I open multiple small windows with javascript?

thanks for any help,
saw [sig][/sig]
 
Hi saw,

you should try to set the open window target to "_blank" so that every time you click on the link, there will be new window pop up

for example...

<a href=&quot;link1.html&quot; target=&quot;_blank&quot;>link1</A>
<a href=&quot;link2.html&quot; target=&quot;_blank&quot;>link2</A>

hope this helps [sig]<p>Chiu Chan<br><a href=mailto:cchan@gefmus.com>cchan@gefmus.com</a><br><a href= America, Inc</a><br>[/sig]
 
The &quot;_blank&quot; didn't seem to help. Here's a clipping of the code. Its using an &quot;onClick&quot; event to run a function that pops up a new window with the info in it. This is all done
on an image mapping.

*******************************************************
<script>
<!--
function show(url,w,h) {
window.open(url,&quot;show&quot;,
&quot;width=&quot;+w+&quot;,height=&quot;+h+&quot;,directories=no,location=no,menubar=no,&quot; +
&quot;resizeable=no,status=no,toolbar=no,scrollbars=yes&quot;); return false; }
//-->
</script>

<body>
<p><map name=&quot;FPMap0&quot;>
<area href=&quot;#&quot; onClick=&quot;return show(' shape=&quot;rect&quot; coords=&quot;16, 11, 75, 51&quot; alt=&quot;Primary User: SA Wallace&quot;>
<area href=&quot;#&quot; onClick=&quot;return show(' shape=&quot;rect&quot; coords=&quot;83, 9, 143, 48&quot; alt=&quot;Primary User: RL Hartman&quot;>

**********************************************************

thanks again,
saw [sig][/sig]
 
Hi saw,

you just need one more input parameter for your show function, try this

*******************************************************
<script>
<!--
function show(url,win_name,w,h) {
window.open(url,win_name,
&quot;width=&quot;+w+&quot;,height=&quot;+h+&quot;,directories=no,location=no,menubar=no,&quot; +
&quot;resizeable=no,status=no,toolbar=no,scrollbars=yes&quot;); return false; }
//-->
</script>

<body>
<p><map name=&quot;FPMap0&quot;>
<area href=&quot;#&quot; onClick=&quot;show(' shape=&quot;rect&quot; coords=&quot;16, 11, 75, 51&quot; alt=&quot;Primary User: SA Wallace&quot;>
<area href=&quot;#&quot; onClick=&quot;show(' shape=&quot;rect&quot; coords=&quot;83, 9, 143, 48&quot; alt=&quot;Primary User: RL Hartman&quot;>

**********************************************************

hope this work
Chiu Chan
cchan@gefmus.com
GEFM America, Inc
 
Oops.. sorry i copy a lot not necessary things.. here the code again..


*******************************************************
<script>
<!--
function show(url,win_name,w,h) {
window.open(url,win_name,
&quot;width=&quot;+w+&quot;,height=&quot;+h+&quot;,directories=no,location=no,menubar=no,&quot; +
&quot;resizeable=no,status=no,toolbar=no,scrollbars=yes&quot;); return false; }
//-->
</script>

<body>
<p><map name=&quot;FPMap0&quot;>
<area href=&quot;#&quot; onClick=&quot;show(' shape=&quot;rect&quot; coords=&quot;16, 11, 75, 51&quot; alt=&quot;Primary User: SA Wallace&quot;>
<area href=&quot;#&quot; onClick=&quot;show(' shape=&quot;rect&quot; coords=&quot;83, 9, 143, 48&quot; alt=&quot;Primary User: RL Hartman&quot;>

**********************************************************

hope this work [sig]<p>Chiu Chan<br><a href=mailto:cchan@gefmus.com>cchan@gefmus.com</a><br><a href= America, Inc</a><br>[/sig]
 
assign the return value of the window.open to a different variable:

win1 = window.open()
win2 = window.open()

jared@aauser.com
 
Thanks PepperPepsi, that works great! Now I just need to make the window that is brought up stay on top. Is there a handy way to do that?

thanks,
saw
[sig][/sig]
 
Thanks jarednn. Only I'll need to be more than one window on top and side by side. Now that I think more about it, it probably shouldn't be fixed to stay on top, since I would need to click on the parent page again to bring up another window.
Thanks for everyone's help!

saw [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top