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

Simple(ish) popup window query

Status
Not open for further replies.

obaluba

Technical User
Sep 24, 2001
49
GB
Hi, I have on my html page 3 different sized popup windows that i wish to use. However i am unsure of the code to resize them. the code i have is below

This is located in the head of the html
<script language=&quot;JavaScript&quot;>
<!--//BEGIN Script

function new_window(url) {

link = window.open(url,&quot;Link&quot;,&quot;toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=2,width=224,height=260,left=80,top=180&quot;);

}
//END Script-->
</script>

This is located in the body
<a href=&quot;javascript:new_window('insulation_perlite.htm')&quot;>Perlite

any ideas how to make one of the windows open at 224 x 260 another open at 300 x 500 ?

any help really would be appreciated!

thanks in advance.
 
Change the function to allow the width and height as parameters. You will also need to have a different window name for them

<script language=&quot;JavaScript&quot;>
<!--//BEGIN Script

function new_window(url,w,h,windowname) {

link = window.open(url,&quot;&quot;,&quot;toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=2,width=&quot;+w+&quot;,height=&quot;+h+&quot;,left=80,top=180&quot;);

}
//END Script-->

</script>


and your links would look like this:
<a href=&quot;javascript:new_window('<a href=&quot;javascript:new_window('
This way you can call as many you like using just one function

Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Sorry, I forgot to add the window name to the window.open command:
link = window.open(url,[red]windowname[/red],&quot;toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=2,width=&quot;+w+&quot;,height=&quot;+h+&quot;,left=80,top=180&quot;);

Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top