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 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Pop-Up Window Help Needed

    There are two ways to fix this problem, but I haven't been able to figure out either. When someone goes to my site, I want a javascript popup to open on the right side and I want it to always be on top. I've figured everything out and gotten it to work with the following code, but I can't figure out how to implement the always on top javascript code (<BODY onBlur="window.focus();"> ) into the pop-up window.

    Here is the code I'm using, placed in the body of the main page:

    <script language=JavaScript>
    var win=window.open('a.html' ,'_BLANK'," toolbar=no,location=no,status=no,menubar=no,scroll
    =no,width=X,height=Y,left=0,fullscreen=1,top=
    0,resizable=no");
    win.resizeTo(X, Y);
    win.moveTo(X, Y);
    win.document.write("<html><Head><Title>TITLE</Title></Head><body topmargin=0 leftmargin=0><img src='http://site.jpg' width=X height=Y alt='' border=0></body></html>");
    </script>

    So I either need to know how to work the onBlur code snippet into the aforementioned code, or how to make the window the code creates load another page with the onBlur code, although the former would be better.

    Also, what code could be inserted to make the pop-up automatically close when the user goes to a different page from the one generating the pop-up?

    THANK YOU IN ADVANCE

  • #2
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    Code:
    <script language="JavaScript">
    window.open('http://www.yourdomain.com','windowname','
    height=320,width=320,scrollbars,resizable'); 
    </script>
    place this just below the <body> tag and it should do the trick

    as for the closing when the user navigates away, try this:

    Code:
    <script language="JavaScript">
    window.open('http://www.yourdomain.com','windowname','
    height=320,width=320,scrollbars,resizable,dependant'); 
    </script>
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #3
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    i use this:

    Code:
    <script type=text/javascript> 
    function newWin(urlLoc) {
      _winName = "popupSelect";
      _info  = "toolbar=no";     // yes|no 
      _info += ",location=no";   // yes|no 
      _info += ",directories=no";// yes|no 
      _info += ",status=no";    // yes|no 
      _info += ",menubar=no";    // yes|no 
      _info += ",scrollbars=no";// yes|no 
      _info += ",resizable=yes"; // yes|no 
      _info += ",dependent";     // close the parent, close the popup, omit if you want otherwise 
      _info += ",height=250";
      _info += ",width=425";
      _info += ",left=150";
      _info += ",top=100";
      DispWin=window.open(urlLoc,_winName,_info);
    } 
          </script>
    and then
    Code:
    <body ... >
    <a href="javascript:newWin('blahblah.htm')">
    modify the above to a window.open
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #4
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is there a way to make it load an image instead of a url?

  • #5
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I'm not sure what dictates the "always on top" out of what you posted..

  • #6
    Senior Coder
    Join Date
    Jul 2003
    Location
    My pimped-out igloo in Canadia
    Posts
    1,966
    Thanks
    36
    Thanked 0 Times in 0 Posts
    to my knowledge (in the first script), not specifying a position defaults it to top=0px, left=0px. but thats just an educated guess

    as for the image. in short, no. that would be asking the image to simply float in space.

    the web page is just a container, if you will, for all the objects to be placed in. you need a url.

    however you can give the semblance of a single image floating using <div>'s.
    do a forum search on "floating div" and you should find a prewritten script or two to do exactly what you want.
    Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you're a mile away and you have their shoes :)

  • #7
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Javascript Pop up help...

    Im in no way a coder.. but ive been trying to get help with this problem for a few months..and i havent found any help..

    Im just simply trying to get my Geocities.com page to load once my .Tk site is accessed.

    Like a Full screen Javascript pop up.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <SCRIPT LANGUAGE="JavaScript">
    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=0,width=800,height=600');");
    }
    // End -->
    
    <title>Enter ME!!!</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    
    <body bgcolor="#000000">
    
    <BODY onLoad="javascript:popUp('http://www.geocities.com/supaskrilla/main.html')">
    </body>
    </html>
    Any guesses why its not working?

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Posts
    676
    Thanks
    1
    Thanked 0 Times in 0 Posts
    sup...
    "quote...Any guesses why its not working?...endquote"

    ummm...just a guessing®...but you have/had TWO body tags...:O(


    <body bgcolor="#000000">

    <BODY onLoad="javascript:popUp('http://www.geocities.com/supaskrilla/main.html')">
    </body>


    n' just a ps®...
    hugs n' welcome to the forum...:O)))

  • #9
    New to the CF scene
    Join Date
    Aug 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Alrighty

    Worked! thanks


  •  

    Posting Permissions

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