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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help With Pop Up Pages

    Hey,

    I was wondering if anyone could give the the HTML code to have pop up windows kind of like the ones used on this page: http://www.degrassinetnow.com/

    I have been trying to this code

    <a href="mypage.html" target="loadedlyrics"
    onclick="window.open('mypage.html','loadedlyrics','height=200,
    width=200,toolbar=no,directories=no,status=no,
    menubar=no,scrollbars=no,resizable=no'); return false;">click here</a>


    is this the right one or is there a way to edit to have have the pop ups like the page?

    thanks in advance.

  • #2
    Regular Coder
    Join Date
    Sep 2005
    Location
    Chicago, IL
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The link you posted doesn't have any pop-ups. What are you trying to do with the pop-up?
    I'm only telling you how I would do it, not how its supposed to be done. ;)

  • #3
    New to the CF scene
    Join Date
    Oct 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm trying to do a pop up that you can make with like the links you have within your pages. Like when you click on like hostees or something on that site that I gave. That's the kind of pop up boxes that I want.

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    You have the right idea. Just adjust the width and height. One thing I would do is make a function.
    Put this in between your head tags
    Code:
    <script type="text/javascript">
    function openWin(url,wid,hgt){
    sw=(screen.width-wid)/2;
    sh=(screen.height-hgt)/2;
    newwin=window.open(url,'','width='+wid+',height='+hgt+',left='+sw+',top='+sh+',scrollbars=1,menubar=0,toolbars=0,status=0');
    newwin.close();
    newwin.focus();
    }
    </script>
    Then put this where you want your link to be on your page.
    Code:
    <a href="mypage.html" target="_blank" onclick="openWin(this.href,'200','200');return false;">click here</a>

  • #5
    Regular Coder
    Join Date
    Sep 2005
    Location
    Chicago, IL
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    pretty much, a pop-up is a pop-up, i mean excluding the fact that you can choose what toolbars they show and they're size. the only problem i'm seeing with your code is that it opens 2 windows. there's 2 ways you could do a basic pop-up window. you can put the code for it in the 'head' section of your page and call on it later or you can do it the way you were doing it. i'll just give you the code for the way you were doing it and if you wanan know how to do it the other way just let me know. so here's the code:

    PHP Code:
    <a href="" onClick="window.open('mypage.html','loadedlyrics','height=200,width=200,scrollbars'); return false;">click here</a
    instead of listing all the things you dont want like 'toolbars=no', etc... you can just put what you do want to show, like above, the scrollbars will only show up if the page is bigger than the size of the pop-up. and you don't need an link in the href="" part because you want to stay at that page and not open a different main page and no target for the same reason. that way it shortens your code big time. if you need anything else, let me know.
    I'm only telling you how I would do it, not how its supposed to be done. ;)

  • #6
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Though the href would be better if it had something. The return false on the end of the script prevents the link from going any where if the user has js enabled.


  •  

    Posting Permissions

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