PDA

View Full Version : Is This Possible? No Joke!



Jamie2993
12-25-2008, 04:53 AM
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:


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");
}

Jamie2993
12-25-2008, 11:56 AM
Any1 know? :)

magicyte
12-25-2008, 03:07 PM
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 :D... 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?

Had messed up code. Would have thrown off client.

Master_script_maker
12-25-2008, 10:01 PM
maybe this could help? http://www.quirksmode.org/js/croswin.html#toopener. from testing it would seem that you could access functions on the main page from the popup using opener.function();, where function is your functionsorry, i thought you wanted to show the music player when the window was closed