How to Add Scroll Bars to Pop-Up Windows

Links coded to open in a pop-up window do not include scroll bars by default. You can alter this behavior with an adjustment to the JavaScript pop-up code that will set the pop-up window to include a scroll bar if the content of the window will take up more space then the set dimensions of the window.

Instructions

    • 1

      Copy and paste the following JavaScript code in the "<head>" portion of the HTML document where the pop-up link will appear. This script will enable more advanced control over pop-up windows.

      <script type="text/javascript">

      <!--

      function popup(mylink, windowname)

      {

      if (! window.focus)return true;

      var href;

      if (typeof(mylink) == 'string')

      href=mylink;

      else

      href=mylink.href;

      window.open(href, windowname, 'width=X,height=X,scrollbars=X');

      return false;

      }

      //-->

      </script>

    • 2

      Set the "scrollbars" variable to "yes" to make the scroll bar visible in the pop-up window and configure the pixel width and height of your pop-up window.

    • 3

      Insert a link using the following code in order to utilize the pop-up script.

      <a href="example.html" onClick="return popup(this, 'Example Name')">Example Link</a>

    • 4

      Save the HTML document and upload it to your website.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured