# \[javascript\] simple pop-up question

**URL:** <https://forum.kirupa.com/t/javascript-simple-pop-up-question/182268>\
**Category:** web dev\
**Created:** [March 16, 2006, 7:22pm UTC](https://forum.kirupa.com/t/javascript-simple-pop-up-question/182268 "2006-03-16T19:22:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![understudy](https://avatars.discourse-cdn.com/v4/letter/u/ec9cab/32.png) [@understudy](https://forum.kirupa.com/u/understudy)\
**Post date:** [March 16, 2006, 7:22pm UTC](https://forum.kirupa.com/t/javascript-simple-pop-up-question/182268/1 "2006-03-16T19:22:57Z")

</div>

[FONT=Trebuchet MS]i’m using the following script to open a pop up window, but when i do, i need there to be a scrollbar and i’m not sure where to add that in the code.

thanks in advance!

my best,  
david

```auto

 <html>
 <head>
 <script type="text/javascript">
 //<![CDATA[
 function popup(url,windowname,width,height) {
     width=(width)?width:screen.width/3;
     height=(height)?height:screen.height/3;
     var screenX = (screen.width/2 - width/2);
     var screenY = (screen.height/2 - height/2);
     var features= "width=" + width + ",height=" + height;
     features += ",screenX=" + screenX + ",left=" + screenX;
     features += ",screenY=" + screenY +",top=" + screenY;
     var mywin=window.open(url, windowname, features);
     if (mywin) 
         mywin.focus();
     return mywin;
 }
 //]]>
 </script>
 </head>
 <body>

 Popup example:<br />

 <a href="http://www.google.com" onclick="popup(this.href,'win1',400,300);return false">
     Google.com in centered sized window</a>

 </body>
 

```

[/FONT]
