Results 1 to 4 of 4

Thread: Is This Possible? No Joke!

  1. #1
    Join Date
    Oct 2007
    Location
    England,Kent
    Posts
    16
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Exclamation Is This Possible? No Joke!

    Hi All,

    Im Making A Music Place For My Website,

    Was Trying to add a new "addiction",

    what this does is:

    if you click the link it hides the music player and shows up in a popup.(ive done this) but this is the part i need help.
    Is It Possible:
    if you click the link again it will close the popup and show the music player?

    my code so far:
    Code:
    function Mpop() {
    
         ID = document.getElementById(2); 
         
         if(ID.style.display == "")
              ID.style.display = "none";
         else 
              ID.style.display = "";
              window.open( "http://music.game-dragon.com/bands/pop/pr.html", "myWindow", "status = 0, height = 200, width = 385, resizable = 0");
          }

  2. #2
    Join Date
    Oct 2007
    Location
    England,Kent
    Posts
    16
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default

    Any1 know?

  3. #3
    Join Date
    Jun 2008
    Posts
    589
    Thanks
    13
    Thanked 54 Times in 54 Posts
    Blog Entries
    1

    Default

    Yes. Let us know if you want some actual code or just some advice. I'll give the advice since it's Christmas and I need to, eh, relax ... Okay, so let's say that you have a link. Once you click it, the pop-up opens. We should tweak the code for when you click on it to where when the user clicks on it, a variable is made true or false. Okay. Let's say the user clicks on the link. After he/she clicks on the link, the link checks to see if the user already clicked on it (to where the pop-up would be open) by looking at a bool variable. If the variable is true, then the pop-up closes and the variable is made false. If the variable is false (in which case the user didn't click on the variable), the pop-up opens and the variable is made true. To close a pop-up, simply use window.close(window_name_opened_here). Any questions?

    Edit: Had messed up code. Would have thrown off client.
    Last edited by magicyte; 12-25-2008 at 10:44 PM.

  4. #4
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    maybe this could help? http://www.quirksmode.org/js/croswin.html#toopener.
    Edit: from testing it would seem that you could access functions on the main page from the popup using opener.function();, where function is your function
    Edit: sorry, i thought you wanted to show the music player when the window was closed
    Last edited by Master_script_maker; 12-25-2008 at 10:13 PM.
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

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
  •