Using window.opener to try and set a value in the originating window

R

RWC

Hello,

I am new to JavaScript but until now, have felt my way along fairly
successfully. I have a page showing an image to the user. I use
window.open to open a separate page, listing a bunch of different images
that the user can select. When the user clicks "Submit", I'd like the image
selection page to close and update the image on the originating page.

To "play around" with this command until I can use it successfully, I wrote
the following;

function Button1_onclick() {
window.opener.document.bgcolor='bisque'
window.opener.location.reload()
window.close()
}

The line for changing the back ground color to bisque I pulled from the
netscape site javascript reference for Window.Opener.

Any help on this would be greatly appreciated.

Thanks in Advance!
Rick
 
D

DU

RWC said:
Hello,

I am new to JavaScript but until now, have felt my way along fairly
successfully. I have a page showing an image to the user. I use
window.open to open a separate page, listing a bunch of different images
that the user can select. When the user clicks "Submit", I'd like the image
selection page to close and update the image on the originating page.

To "play around" with this command until I can use it successfully, I wrote
the following;

function Button1_onclick() {
window.opener.document.bgcolor='bisque'

opener.document.style.backgroundColor = "#FFE4C4";
//bisque == #FFE4C4 == 255,228,196
window.opener.location.reload()
opener.location.reload(true);

window.close()

if(window.close)
{
window.close();
};

Note that you can not close a window not opened by javascript. Also,
some browsers (Mozilla-based browsers) can prevent javascript-initiated
window from being closed via javascript.
}

The line for changing the back ground color to bisque I pulled from the
netscape site javascript reference for Window.Opener.

Any help on this would be greatly appreciated.

Thanks in Advance!
Rick

What was not working? Can you provide an url where the problem is?

DU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top