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

Possible to open 2 different sized new Windows?

Status
Not open for further replies.

Nina2001

Programmer
Dec 28, 2001
58
US
Hi all. I have a webpage that I have two different links to open new windows. Is it possible to have them open in different sizes? The first one I want to open as a standard new window size and the second as described below. Here's what I have in my HTML but both windows are opening in the size/format of the 2nd window. I tried putting in a different width and height for the first one but it still opened with the formatting of the second link.

<script language=&quot;javascript&quot;>
function openNewWindow(url) {window.open(url,'newPage','scrollbars=yes,resizable=yes');
}
</script><a href=&quot;javascript:eek:penNewWindow('
<script language=&quot;javascript&quot;>
function openNewWindow(url) {window.open(url,'newPage','scrollbars=no,resizable=no,width=600,
height=430');
}
</script><a href=&quot;javascript:eek:penNewWindow('
Any help is greatly appreciated. Thanks.
 
You have two functions with the same name on the page, that's why no matter on what link you click, it always refers by default to one of them. Also you are missing some single quotation marks: (' should be (' The simpiest solution would be to change the name of the second function and reference to it:
Code:
<script language=&quot;javascript&quot;>
 function openNewWindow(url) {
  window.open(url,'newPage','scrollbars=yes,resizable=yes');
}
</script>
<a href=&quot;javascript:openNewWindow('[URL unfurl="true"]http://www.webaddress.com');&quot;>Link1</a>[/URL] 

<script language=&quot;javascript&quot;>
 function openNewWindow2(url){
  window.open(url,'newPage','scrollbars=no,resizable=no,width=600,
height=430');
}
</script>
<a href=&quot;javascript:openNewWindow2('[URL unfurl="true"]http://www.webaddress2.com');&quot;>Link2</a>[/URL]
Or you can change the openNewWindow function and have the features passed to it as a parameter:
Code:
<script language=&quot;javascript&quot;>
 function openNewWindow(url, features){
  window.open(url,'newPage', features);
 }
</script>

<a href=&quot;javascript:openNewWindow('[URL unfurl="true"]http://www.webaddress.com',[/URL] 'scrollbars=yes,resizable=yes');&quot;>Link1</a>
<a href=&quot;javascript:openNewWindow('[URL unfurl="true"]http://www.webaddress2.com',[/URL] 'scrollbars=no,resizable=no,width=600,
height=430');&quot;>Link2</a>
 
Thanks. I used the first option. I thought I needed to change a name somewhere. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top