SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What's wrong with my popup?

    If you visit http://cia.geoworld.org/France, find the text, "This links to a popup window" and click the link, the "popup" opens as a full page in a new tab (in Firefox and Opera, at least).

    Can anyone tell me what I'm doing wrong? I used the "Accessible Pop-up Window Generator" on this page: http://accessify.com/tools-and-wizar...or/default.php

    This is what I placed on my page:

    Code:
    <a href="http://cia.geoworld.org/images/maps/fr-map.gif" target="popUpWin" onclick="popUpWin(this.href,'standard',400,400);return false;">This links to a popup window.</a>
    ...and this is the contents of my js file:

    Code:
    // POPUP
    var newWindow = null;
    
    function closeWin(){
    	if (newWindow != null){
    		if(!newWindow.closed)
    			newWindow.close();
    	}
    }
    
    function popUpWin(url, type, strWidth, strHeight){
    	
    	closeWin();
    	
    	if (type == "fullScreen"){
    		strWidth = screen.availWidth - 10;
    		strHeight = screen.availHeight - 160;
    	}
    	
    	var tools="";
    	if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
    	if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=no,width="+strWidth+",height="+strHeight+",left=0,top=0";
    	newWindow = window.open(url, 'newWin', tools);
    	newWindow.focus();
    }
    I must be correctly linked to my JS file at http://cia.geoworld.org/a1/js/popup.js...

    Code:
    <script type="text/javascript" src="/ai/js/popup.js"></script>
    So I'm not sure what I did wrong.

    Thanks.

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The path is wrong. It is probably a server configuration error. When it's accessing root which the beginning slash tells it to it seems to be accessing the parent directory of the directory it should access. So change all paths that point to files in "/a1/js/" to "a1/js/".

    Please fix your XHTML errors.

    Remove the target attribute and the following which puts IE6 into quirks mode.
    Code:
    <?xml version="1.0" encoding="iso-8859-1"?><!--index.php-->
    Why should you avoid using tables for layout?
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Kravvitz View Post
    The path is wrong. It is probably a server configuration error. When it's accessing root which the beginning slash tells it to it seems to be accessing the parent directory of the directory it should access. So change all paths that point to files in "/a1/js/" to "a1/js/".
    I was worried about that possibility, since this is a subdomain. However, my style sheets use the same type of link and work fine. At any rate, I tried it without the initial /, and it still doesn't work.

    Remove the target attribute...
    You mean delete this?:

    Code:
     target="popUpWin"
    Maybe it will work after I fix some of the validation errors you cited. Thanks!

  4. #4
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, that's the target attribute.

    Actually, after looking at it again, it seems you typed "/ai/js/popup.js" instead of "/a1/js/popup.js".

    The other .js files don't seem to be in "/a1/js/".
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  5. #5
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah, that was a dumb mistake. Anyway, it's working now - and I have less validation errors.

    Thanks.


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
  •