Results 1 to 4 of 4

Thread: PopUp in PHP

  1. #1
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default PopUp in PHP

    I am in the process of building an e-commerce site in PHP (not my work) What I want to do is have certain pages such as About Us and FAQ pop up in a small unadorned window with a "close window" control and nothing more except it would be nice to have a specific border color along the top bar.

    My question is this:- Of all the scripts written in Dynamic Drive...which one am would I be best to use given my limited expertise in PHP development.

    Thanks for your help

  2. #2
    Join Date
    Mar 2008
    Posts
    58
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default

    heres a script you could use:


    Code:
    <SCRIPT LANGUAGE="JavaScript">
    
    function popup(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=1280,height=1024');");
    }
    
    </script>
    put that in your head tags,
    then in the body tags put:

    Code:
    <form>
    	<input type="WHATEVER INPUT TYPE" value="Open the Popup Window" onClick="javascript:popup('LINK GOES HERE')">
    </form>
    also in the bolded part of the previous form code, if you want to make it an image, put
    <input type="image" ... followed by src="source.png/gif/whatever"

    and you will have your popup, also, heres a live preview i setup for you

    www.voi-design.com/test.html

    ^^my site, not open for awhile, im a graphics designer.

    im going to look into setting the size and form placment on the screen for it, hope i helped?

    PHP:

    Code:
    <a href="javascript: window.open('index.html', 'window_name', 'width = 250, height = 50');">INDEX TEST</a>
    way simpler, but there is one thing that is wierd about it, go to www.voi-design.com/test.html and click "INDEX TEST", it changes the page....












    EDIT: SCRAP ALL THAT, just use this


    Code:
    <form>
    	<input type="submit" value="Popup window" onClick="javascript: window.open('LINK GOES HERE', 'window_name', 'width = 250, height = 50');">
    </form>













    edit 2: -final solution-

    1. in your head tags, put:
    Code:
    <SCRIPT TYPE="text/javascript">
    <!--
    function popup(mylink, windowname)
    {
    if (! window.focus)return true;
    var href;
    if (typeof(mylink) == 'string')
       href=mylink;
    else
       href=mylink.href;
    window.open(href, windowname, 'width=400,height=235,scrollbars=yes');
    return false;
    }
    //-->
    </SCRIPT>
    edit the bolded red text accordingly

    2: in the link that you want to initiate the popup, put:

    Code:
    <A HREF="LINK" onClick="return popup(this, 'notes')">WHATEVER</A>
    edit the bolded red accordingly and there you go!

    i set another live preview up at www.voi-design.com
    click on "Order a design "HERE""



    this also helped me alot too, thanks! (sorry for the huge long post)
    Last edited by Anexxion; 03-02-2008 at 09:33 PM.

  3. #3
    Join Date
    Jun 2005
    Location
    Canada
    Posts
    68
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your help Anexxion. I will be working with these codes over the next few days to see how it all comes together.

  4. #4
    Join Date
    Mar 2008
    Posts
    58
    Thanks
    22
    Thanked 0 Times in 0 Posts

    Default

    yeah no problem, i myself didnt know how to do it, just use the "final solution", i have yet to find out how to place it with javascript on the page, then dim everything else but the document

Bookmarks

Posting Permissions

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