SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Adding a scrollbar to my script

    Hi,

    javascript n00b here.

    I grabbed some javascript code from an online example to allow for an image to appear in a pop up window. I want to add a scroll bar, but I can't figure out how or find it on google.

    code:

    Code:
    <script language="JavaScript1.2" type="text/javascript">
    <!-- ;
    var newwindow;
    var wheight = 0, wwidth = 0;
    
    function popitup5(url, title, iwidth, iheight, colour) {
    var pwidth, pheight;
    
    if ( !newwindow || newwindow.closed ) {
    pwidth=iwidth+30;
    pheight=iheight+30;
    newwindow=window.open('','htmlname','width=' + pwidth +',height=' +pheight + ',resizable=1,top=50,left=10');
    wheight=iheight;
    wwidth=iwidth;
    }
    
    if (wheight!=iheight || wwidth!=iwidth ) {
    pwidth=iwidth+30;
    pheight=iheight+90;
    newwindow.resizeTo(pwidth, pheight);
    wheight=iheight;
    wwidth=iwidth;
    }
    
    newwindow.document.clear();
    newwindow.focus();
    newwindow.document.writeln('<html> <head> <title>' + title + '<\/title> <\/head> <body bgcolor= \"' + colour + '\"> <center>');
    newwindow.document.writeln('<img src=' + url + ' title=\"' + title + '\" alt=\"' + title + '\" >');
    newwindow.document.writeln('<\/center> <\/body> <\/html>');
    newwindow.document.close();
    newwindow.focus();
    }
    
    // Routines to tidy up popup windows when page is left
    // Call with an onUnload="tidy5()" in body tag
    
    function tidy5() {
    if (newwindow && !newwindow.closed) { newwindow.close(); }
    }
    
    // Based on JavaScript provided by Peter Curtis at www.pcurtis.com -->
    </script>
    Thanks for any help.
    No, I REALLY dislike having to use Joomla.

  2. #2
    SitePoint Enthusiast
    Join Date
    May 2006
    Posts
    47
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    WindowObjectReference = window.open(strUrl, strWindowName [, strWindowFeatures]);

    add scrollbars=yes in the strWindowFeatures argument

    http://developer.mozilla.org/en/docs/DOM:window.open

  3. #3
    derrrp
    Join Date
    Aug 2006
    Location
    earth
    Posts
    923
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by thedeathart
    WindowObjectReference = window.open(strUrl, strWindowName [, strWindowFeatures]);

    add scrollbars=yes in the strWindowFeatures argument

    http://developer.mozilla.org/en/docs/DOM:window.open
    Thanks so much.

    It's funny, I was trying scrollbar=true, scroll=true, scrollbar=yes and scroll=yes...
    No, I REALLY dislike having to use Joomla.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •