Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Pop up window not opening

  1. #1
    Join Date
    Jan 2009
    Location
    NH
    Posts
    675
    Thanks
    98
    Thanked 26 Times in 26 Posts

    Question Pop up window not opening

    On this page I created, under the videos, a responsive grid of images thanks to Bev.

    Sorry, I couldn't post the html, it said it was too long. Can you right click on the page and view the source?

    This is a link that I asked about this a long time ago. I got it to work but now it doesn't.

    thanks
    Mike
    Last edited by mlegg; 10-05-2015 at 09:01 PM.

  2. #2
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    That's probably because there's a 404 error on your linked pages. For example:

    http://www.pscompetitiveedge.com/ltrs/bluewater.html

    Have you misspelled a directory path?

  3. #3
    Join Date
    Jan 2009
    Location
    NH
    Posts
    675
    Thanks
    98
    Thanked 26 Times in 26 Posts

    Default

    Each image is linked to an htm page like this
    <div class="grid"><a href="javascriptopUp('ltrs/bluewater.htm')"><img src="photos/logo/bluewater.jpg" alt="Bluewater Resort &amp; Casino" width="150" height="76" border="0"></a></div>

  4. #4
    Join Date
    Jan 2009
    Location
    NH
    Posts
    675
    Thanks
    98
    Thanked 26 Times in 26 Posts

    Default

    oops double post

  5. #5
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    Quote Originally Posted by mlegg View Post
    Each image is linked to an htm page like this
    <div class="grid"><a href="javascriptopUp('ltrs/bluewater.htm')"><img src="photos/logo/bluewater.jpg" alt="Bluewater Resort & Casino" width="150" height="76" border="0"></a></div>
    Yes, I can see that in your source code, but the link created by the JavaScript doesn't lead anywhere! Try clicking on this link:

    http://www.pscompetitiveedge.com/ltrs/bluewater.html

  6. #6
    Join Date
    Jan 2009
    Location
    NH
    Posts
    675
    Thanks
    98
    Thanked 26 Times in 26 Posts

    Default

    How can I fix this? I want people to be able to click on the logos on the page, and when they click on that, I want a popup window to open to show the letter from the company.
    This used to work before but the last few months I changed the html on that page and may have missed something.

  7. #7
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    488
    Thanks
    0
    Thanked 62 Times in 58 Posts

    Default

    Quote Originally Posted by mlegg View Post
    How can I fix this? I want people to be able to click on the logos on the page, and when they click on that, I want a popup window to open to show the letter from the company.
    This used to work before but the last few months I changed the html on that page and may have missed something.
    Nobody else can fix it for you, but here's some hints.

    I don't know if you used the code from Arie or Beverley, but either way you have to find the JavaScript source for the popUp() function. I had a quick look at your page but couldn't see it so you may have deleted either the code or the link to the file containing the code in the <head></head> section of your page. Once you have found that code you need to see how it uses the path parameter which is passed to it. From reading your other thread I have assumed that the line:

    Code:
    <div class="grid"><a href="javascript:popUp('ltrs/bluewater.htm')"><img src="photos/logo/bluewater.jpg" alt="Bluewater Resort &amp; Casino" width="150" height="76" border="0"></a></div>
    will create the following path for the popup window:

    Code:
    http://www.pscompetitiveedge.com/ltrs/bluewater.html
    As I already wrote in post #2, that path gives a 404 error. It's possible that my assumption about the way the JavaScript function popUp() uses the parameter "ltrs/bluewater.html" is wrong but, if not, then either the directory "ltrs" or the file "bluewater.html" doesn't exist! Only you can fix that.

  8. #8
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Hello Mike,
    It seems you removed the popUp-script from your page. I don't know what the script looked like, so I made a new one for your. Put the following lines in the head section:
    Code:
    <script>
    var alertmessage="The window you're about to open doesn't have buttons for 'back' and 'forward', but you can use the keyboard: \n- press the BACKSPACE button or ALT + left arrow for going back in the newly opened window, \n- use SHIFT+BACKSPACE or ALT + right arrow for going forward in the newly opened window."
    
    function prompt_once_per_session()
    {
    if( !/(^|\s|;)seenAlert=yes(;|\s|$)/.test(document.cookie))
    {if( !confirm(alertmessage+'\n\nClick on OK if you don`t want this message to show again.\n\nClick on CANCEL if you want this message to show each time you open a new window.') )
    {}
    else {document.cookie="seenAlert=yes";}
    }
    }
    
    function windowsize()
    {
    window_height=Math.max(document.body.scrollHeight, document.body.offsetHeight, document.documentElement.clientHeight, document.documentElement.scrollHeight, document.documentElement.offsetHeight)
    window_width=Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth)
    w=window_width/(100/width), h=window_height/(100/height);
    l = (window_width-w)/2-10;
    t = 15+(window_height-h)/2;
    }
    
    function size_it(the_width,the_height)
    {
    width=the_width;
    height=the_height;
    windowsize();
    }
    
    
    function popUp(url,the_width,the_height)
    {
    size_it(the_width,the_height);
    pop_it_up_prep(url)
    }
    
    
    var popUpWin ;
    var url;
    var autoclose = true;
    var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1 ;
    
    function pop_it_up_prep(url){
    if(is_chrome)prompt_once_per_session(); // message for Google Chrome users
    if (popUpWin) {popUpWin.close()}
    if (popUpWin && autoclose){window.onunload=function(){popUpWin.close()}}
    popUpWin=window.open(url,"","menubar=no, toolbar=yes, titlebar=no, directories=no, status=0, scrollbars=yes,location=yes,top="+t+",left="+l+",width="+w+",height="+h+", resizable=1"); 
    if (window.focus){popUpWin.focus() }  
    
    }
    </script>
    Then in the body use links like:
    Code:
    <div class="grid"><a href="javascript:popUp('http://www.pscompetitiveedge.com/ltrs/bluewater.htm', 80, 80)"><img src="http://www.pscompetitiveedge.com/photos/logo/bluewater.jpg" alt="Best Western" width="100" height="89" border="0"></a></div>

  9. #9
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    Quote Originally Posted by styxlawyer View Post
    [...] will create the following path for the popup window:
    Code:
    http://www.pscompetitiveedge.com/ltrs/bluewater.html
    As I already wrote in post #2, that path gives a 404 error. It's possible that my assumption about the way the JavaScript function popUp() uses the parameter "ltrs/bluewater.html" is wrong but, if not, then either the directory "ltrs" or the file "bluewater.html" doesn't exist! Only you can fix that.
    Mike's links do work. The path is not http://www.pscompetitiveedge.com/ltrs/bluewater.html, but http://www.pscompetitiveedge.com/ltrs/bluewater.htm

  10. #10
    Join Date
    Jan 2009
    Location
    NH
    Posts
    675
    Thanks
    98
    Thanked 26 Times in 26 Posts

    Default

    it's working, I found my old page in my folder and forgot this in the head
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    <!-- Begin
    function popUp(URL) {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=675,height=465,left = 110,top = 45');");
    }
    // End -->
    
    </script>

Similar Threads

  1. Opening a new window within a window with facebox.
    By maxisky in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 11-18-2008, 02:43 PM
  2. Opening a new window when closing another
    By Juniper79 in forum JavaScript
    Replies: 0
    Last Post: 10-12-2008, 04:32 AM
  3. DHTML Window Widget: Close Window-Layer(s) While Opening Another
    By twohawks in forum Dynamic Drive scripts help
    Replies: 2
    Last Post: 10-06-2007, 07:03 PM
  4. opening in a new window
    By eurows in forum JavaScript
    Replies: 4
    Last Post: 08-31-2007, 06:51 AM
  5. Auto center window script- Opening another window
    By gerlis in forum Dynamic Drive scripts help
    Replies: 0
    Last Post: 12-15-2006, 11:41 AM

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
  •