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

Thread: popup help

  1. #1
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts

    popup help

    hello,
    i'm just trying to open a popup function from a button,
    but I guess I'm doing something wrong,

    my code:
    PHP Code:
    <script>
    function 
    mypopup()
     {
       
    mywindow window.open ("http://somesite.com",
      
    "mywindow","location=1,status=1,scrollbars=1,
      width=100,height=100"
    );
      
    mywindow.moveTo(0,0);
     }
    </script>
    <input type='button' value='popup' onClick="mypopup()"; /> 
    any ideas?

    thanks in advance for your time!
    -Ken

  • #2
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Try:
    Code:
    function mypopup() {
    
    	var mywindow = window.open('http://www.somesite.com','mywindow','location=1,status=1,scrollbars=1,top=0,left=0,width=100,height=100');
    
    }
    i.e. no gaps between the window features (just commas).

    (I also positioned the popup using the top and left features rather than create it and move it.)
    Last edited by Bill Posters; 01-24-2006 at 04:42 PM.

  • #3
    Senior Coder angst's Avatar
    Join Date
    Apr 2004
    Location
    Toronto, Ontario
    Posts
    2,114
    Thanks
    15
    Thanked 122 Times in 122 Posts
    kool,
    just one more question,
    how do I pass the url to the function

    PHP Code:
    <script>
    function 
    mypopup(url) {

        var 
    mywindow window.open('+url+','mywindow','location=0,status=0,scrollbars=0,top=0,left=0,width=400,height=400');

    }
    </script>
    <input type='button' value='popup' onClick="mypopup("http://www.google.com")"; /> 
    thanks again,
    -Ken


  •  

    Posting Permissions

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