A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Popup Window Q.2

  1. #1
    Member
    Join Date
    Feb 2012
    Location
    Cairns - Great Barrier Reef - Australia
    Posts
    86

    Popup Window Q.2

    "Sorry didnt notice Id picked the wrong forum link"

    Back there again!.. Do I just want to make my life hard?.. lol...

    Its a tricky script(idea) I havent seen it done!.....

    Theres a lot of popup win centered scripts, theres a couple of popup win by % not px scripts around...... Theres none doing the 2 together.... I was hidding behind window by % with "center:yes" tag but only works in ie...

    I understand why.. Im asking the impossible, a centered popup win that has no idea what the new windows % size will be.. How do you center that??....

    Have spent a couple of days trying to merge.. man there was some ugly code.. lol.... This is as close as I can get (test and youll see the prob)....

    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    
    <SCRIPT LANGUAGE="JavaScript">
    function MyPopUpWin() {
    var iMyWidth;
    var iMyHeight;
    
    iMyWidth = (window.screen.width/2);
    
    iMyHeight = (window.screen.height/2);
    
    var winWidth=screen.width*.4; 
    
    var winHeight=screen.height*.3; 
    
    var win2 = window.open("https://www.facebook.com/login.php","Window2","status=no,height="+winHeight+",width="+winWidth+",resizable=yes,left=" + iMyWidth + ",top=" + iMyHeight + ",screenX=" + iMyWidth + ",screenY=" + iMyHeight + ",toolbar=no,menubar=no,scrollbars=yes,location=no,directories=no");
    win2.focus();
    }
    </SCRIPT>
    
    </head>
    
    <body>
    
    <A HREF="javascript:MyPopUpWin()">This is the link</a>
    
    </body>
    If theirs anyway to improve on this output would be grateful... Cheers B
    Last edited by Back2012; 03-21-2012 at 06:44 PM.
    Defy the boundaries!.. NEVER surrender to the code!!!.....

  2. #2
    Member
    Join Date
    Feb 2012
    Location
    Cairns - Great Barrier Reef - Australia
    Posts
    86

    I get away with this in ie & fox.. but not chrome?.. : (

    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    
    
    <script type="text/javascript">
    <!--
    function popup(url) 
    {
     var width  =screen.width*.7;
     var height =screen.height*.5;
     var left   = (screen.width  - width)/2;
     var top    = (screen.height - height)/2;
     var params = 'width='+width+', height='+height;
     params += ', top='+top+', left='+left;
     params += ', directories=no';
     params += ', location=no';
     params += ', menubar=no';
     params += ', resizable=yes';
     params += ', scrollbars=no';
     params += ', status=no';
     params += ', toolbar=no';
     newwin=window.open(url,'windowname5', params);
     if (window.focus) {newwin.focus()}
     return false;
    }
    // -->
    </script>
    
    
    
    </head>
    
    <body bgcolor="#000000" text="#000000>
    
    
    <a href="javascript: void(0)" 
       onclick="popup('https://www.facebook.com/login.php')">Centered popup window</a>
    
    
    </body>
    </html>
    Defy the boundaries!.. NEVER surrender to the code!!!.....

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center