Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Oct 2002
    Location
    USA
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Javascript openup function

    I use the following javascript to open a new window from the page.

    -------------------------------
    //Begin openup function
    function openup(newpage, name) {
    window.open(newpage, name, "width=723, height=450, scrollbars=yes, resizable=no, toolbar=no, status=no, location=no, menubar=no");
    }
    // END openup function
    ------------------------------

    It all works fine.

    But now I have another button in the page that I want to be opened in a new page BUT IN DIFFERENT DIMENTIONS.

    How do I put two openup functions with different window dimentions without causing a conflict?

    Thanks!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    sss...
    call it just a nother® function...
    where ya nowww have the script like...
    function openup etc...
    just a go®...
    function openup2 etc...


    orrr...ya can do it just a like® reyn did for images by reusing the same script...only just a call® for htmls instead of jpg...
    Code:
    Well, that's just a matter of knowing the image's dimensions beforehand, and using that as the parameters for opening a window of the specified size.
    This simple reusable function can be called by any link that passes it the image filename, and the height and width of the image, then pops out the image in a new window of approximately that size.
    
    Somewhere in the HEAD, insert:
    <script language="JavaScript">
    <!--
    function show(pic,h,w){
    var size="height="+h+",width="+w;
    var show=open(pic,'',size)}
    //-->
    </script>
    And for example, you want to show an image 300 pixels high x 300 pixels wide. Then just call the function and pass it the correct parameters, in this order: filename.jpg,height, and width.
    
    <a href="javascript:show('mypic.jpg',320,320)">Show me</a>
    
    The added 20 is optional to offset for the default top and left margins of browsers.
    just a goodluck® n' hopes that helps ya...
    just a ps®...youd go in this order...
    filename.html,height, and width

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    just a... whoa! Hi justame! Long time no see!
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

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