Results 1 to 3 of 3

Thread: Need some help with popup script please.

  1. #1
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Need some help with popup script please.

    1) Script Title: Popup Window Generator

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/popwin.htm

    3) Describe problem:

    Hi.

    Can someone please help me out with this popup script.
    Why I can"t test the script (below) offline, or is it normal that it works only online?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Popup</title>
    <script language="javascript" type="text/javascript">
    <!--
    /****************************************************
    Author: Eric King
    Url: http://redrival.com/eak/index.shtml
    This script is free to use as long as this info is left in
    Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
    ****************************************************/
    var win=null;
    function NewWindow(mypage,myname,w,h,scroll,pos){
    if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
    if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
    else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,re sizable=no';
    win=window.open(mypage,myname,settings);}
    // -->
    </script>
    </head>

    <body>
    <a href="http://www.google.com" onclick="NewWindow(this.href,'mywin','400','300','no','center');return false" onfocus="this.blur()">YourLinkText</a>
    </body>
    </html>
    Thanks,
    Cheng
    Last edited by Cheng; 09-27-2007 at 07:32 AM.
    Cheng

  2. #2
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Default

    The script you've provided working correctly for me in both MS IE and Mozilla FF without any problem. Just open the page in your browser and click the link and that will open a popup window.

    If you are getting any error or messages please post that things here or mention a URL of the page in your posting.

  3. #3
    Join Date
    Jan 2006
    Posts
    234
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the quick reply.
    The script was working fine but I couldn't test it offline which is now working again, don"t ask me why that is.
    I just thought that I was doing something wrong with the script.

    Thanks again,
    Cheng

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
  •