Click to See Complete Forum and Search --> : Open a Window and Change a Link


GavinPearce
01-17-2003, 12:23 PM
I was wondering if someone might be able to help me and the school i'm working for. What I need is a script that displays a link on the body of a page that says something like
Sound Off. When clicked it it opens a new window 297w 300h and the link changes to say Sound On.
However when the window closes I want the link to change back and say Sound Off

I've something similar in javascript before. Could somebody please help me?!

Yours,
Gavin Pearce

khalidali63
01-17-2003, 05:31 PM
Take a look at the zipeed files,Hope it works for you

cheers

Khalid

MarkR1248
01-17-2003, 05:42 PM
Hmm...

I can show you how you can go about doing this:

I would suppose that you need a cookie holding the informatio "sound off", "sound on".

By default (or when the user first enters, and thus, there is no cookie), the link will see "sound off".

In the main page, a JavaScript will check the cookie and know whether to document.write "sound off" or "sound on".

When someone launches the pop-up window, the cookie will be set to "sound on" AND the pop-up window has to do opener.reload() to refresh the main window, and write in the differnet link.

Closing the pop-up window, will activiate (using onUnLoad) another JavaScript code to set the cookie to "Sound off", and again reload the main window.

The coding is a bit involved for me to wrote for you at the moment, but, if you can find various codes for each part, and place it all together.

I might be able to help you out more later...

Cheers

GavinPearce
01-18-2003, 05:05 AM
Thank You both.

Yours,
Gavin Pearce