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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

click one link to open a page in 2 windows

Status
Not open for further replies.

JoeM6

Programmer
Aug 5, 2000
53
0
0
US
gamecentral.20m.com
Sorry if the subject sounds confusing, but ill try and explain my problem. I have a page, and I want it so when i click on a link, it opens a new window with a page in it, and also opens a page in the first window as well. Is there a way to do this?

JoeM6
JPMJR11@aol.com
 
<script>
openwin(url)
{
window.open(url,name,attributes);
}
</script>

<a href=&quot;url&quot; onclick=&quot;openwin(url)&quot;>link</a>

Check out faq216-329 for window.open attributes.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
hi,
i totally agree with tanderso solution, but as u have asked about opening 2 windows, so i have made slight modification on the code.

<script>
function openwin(url1,url2)
{
window.open(url1,&quot;&quot;,&quot;&quot;);
window.location = url2 ;
}
</script>
<html>
<body>
<a href=&quot;javascript:eek:penwin('x.html','y.html')&quot;>link</a>
</body>
</html>

- ayyappan
 
madura12, I'm not sure why you would make that change. Yes, it should work, but so will putting a url in the href and another in the onclick. It seems like you are making it unnecessarily complex.
Sincerely,

Tom Anderson
CEO, Order amid Chaos, Inc.
 
Madura12, i am not opening 2 popups, i am only using one. If you would like to know the code that worked for me, its:
[tt]
<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
function popUp(URL) {
day = new Date();
id = day.getTime();
eval(&quot;page&quot; + id + &quot; = window.open(URL, '&quot; + id + &quot;', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=600,height=400,left = 20,top = 40');&quot;);
}
</script>

<A HREF=&quot;same page url&quot; onclick=&quot;javascript:popUp('popup window url')&quot;>Open the Popup Window</A>[/tt]
thanks for all your help

JoeM6
JPMJR11@aol.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top