A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: [RESOLVED] Popup Window Q.?

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

    resolved [RESOLVED] Popup Window Q.?

    Hey Flash-Kit gang!...

    Weve all seen a million popup window scripts around the place... My question is about the new windows width & height?.... in all demo's there set by pexils... eg. 600px by 400px...

    Was woundering/desperately hoping, is there anyway to have it open by "%" x & y instead???..

    ----------detailed--------

    Have built a self learning site in a basic frameset.. only to find you cant open sites like Facebooks and Googles etc in frames?... Bummer!!!.. lol...

    So am thinking I have no choice but to open these links in a popup window?.. Say the new (to me) modal style window, at say 95% by 95%.. Unless someone could suggest other way?.......

    Cheers B
    Defy the boundaries!.. NEVER surrender to the code!!!.....

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    I'd suggest you avoid working with frames to teach yourself. They're deprecated, and have a host of usability issues. I'd also suggest avoiding opening new windows. New windows also have usability problems, and guess at your user's intention. They may not want to open the link in a sized window. If you want to present information without leaving the page, it's typically better to create an element that's part of that page that appears and disappears.

    But since you asked...

    You can't just put say, 50% into your window opening code. If you want to open it at a percentage of the screen size, you'd have to detect the screen size in javascript and then use that in your window opening code.

    For example:

    Code:
    <script>
    	function openWindow(){
    		var winWidth=screen.width*.5;
    		var winHeight=screen.height*.5;
    		window.open('http://www.google.com','popWin','width='+winWidth+',height='+winHeight+'');
    	}
    </script>
    <a href="#" onclick="openWindow()">Google</a>
    Last edited by rdoyle720; 03-07-2012 at 12:33 PM.

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

    Great script!.. Thx mate!

    Im on the same pg dude... the more I push it, greater the risk of compatibility issues etc!.... Im wanting to find out just how hard I can push ie.9?.. so safari, fox and google are already out!..

    Id rather support the underdogs like fox's open source.. but ie.9 seems to have the most bite at the mo........

    I dont want to take another sec of your time dude.. so grateful for your help and dont want to push my luck....

    But if its something you can do in 2sec's and me 2 weeks?.. lol....

    Q. How to merge the script I want to use with your great script?...

    Mine: Centered Modal Window

    Code:
    <script>
    function doThis()
    {
    alert("what?");
    }
    function createModal()
    {
      var url_source="https://www.facebook.com/login.php"; /* define if you want a page popped into it */
      var modal_dim="dialogWidth:800px; dialogHeight:500px; center:yes";
      var x = window.showModalDialog(url_source,"",modal_dim);
    }
    </script>
    <a href="javascript:createModal()">create a modal window</a>
    Thanks again for helping a Rookie!

    ps - it has to be a modal window as I'll be going fullscreen in html.. removing the risk of popup windows getting lost in the background!
    Last edited by Back2012; 03-07-2012 at 02:52 PM.
    Defy the boundaries!.. NEVER surrender to the code!!!.....

  4. #4
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Code:
    function createModal()
    {
    var url_source="https://www.facebook.com/login.php"; /* define if you want a page popped into it */
    var winWidth=screen.width*.5;
    var winHeight=screen.height*.5;
    var modal_dim="dialogWidth:"+winWidth+"; dialogHeight:"+winHeight+"; center:yes";
    var x = window.showModalDialog(url_source,"",modal_dim);
    }

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

    Bummer dude?!

    Thanks heaps for the script adjustments... I "now" understand it better, shame it doesnt work?... Im with you, it should have?... but rather than 50% x,y... its giving out 100% x,y?...

    Code:
    <html>
    <head>
    <title>Untitled Document</title>
    
    
    <script>
    	function openWindow()
                {
                   var url_source="https://www.facebook.com/login.php"; /* define if you want a page popped into it */
                   var winWidth=screen.width*.5;
                   var winHeight=screen.height*.5;
                   var modal_dim="dialogWidth:"+winWidth+"; dialogHeight:"+winHeight+"; center:yes";
                   var x = window.showModalDialog(url_source,"",modal_dim);
                }
    </script>
    
    
    </head>
    
    <body bgcolor="#000000" text="#000000">
    
    
    <a href="#" onclick="openWindow()">facebook</a>
    
    
    </body>
    </html>
    Will keep trying... Ty B
    Defy the boundaries!.. NEVER surrender to the code!!!.....

  6. #6
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    Code:
    var modal_dim="dialogWidth:"+winWidth+"px; dialogHeight:"+winHeight+"px; center:yes";

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

    Pure Perfection!!!

    12yrs Ive waited for this kind of control over a popup window... u understand I cant thank you enough dude!.. Ty....

    Now the horrid task of adding this to a flash button?!.. haha... Nope, its time for me to stop hiding behind the basics of the time line & man up!....

    Will spend the next few days trying to work that out on my own?... Back in 3-4 days if Im going completely mad?!... lol....

    Good Luck to all fellow "Flashers!".....

    Thanks again mate B
    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