Connecting Tech Pros Worldwide Forums | Help | Site Map

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

RWC
Guest
 
Posts: n/a
#1: Jul 23 '05
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




DU
Guest
 
Posts: n/a
#2: Jul 23 '05

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


RWC wrote:[color=blue]
> 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'[/color]

opener.document.style.backgroundColor = "#FFE4C4";
//bisque == #FFE4C4 == 255,228,196
[color=blue]
> window.opener.location.reload()[/color]

opener.location.reload(true);
[color=blue]
> window.close()[/color]

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.
[color=blue]
> }
>
> 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
>[/color]

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

DU
--
The site said to use Internet Explorer 5 or better... so I switched to
Firefox 1.0.3 :)
RWC
Guest
 
Posts: n/a
#3: Jul 23 '05

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


Hi DU,

Thanks for the info. I tried what you suggested, but I still can't get it
to work. The pages I'm playing around with are;

http://www.plussafety.com/asppage1.asp

and

http://www.plussafety.com/asppage2.asp

Any suggestions you could give would be greate.

Thanks!
Rick
"DU" <drunclear@hotNOSPAMmail.com> wrote in message
news:3e86reF1l9ssU1@uni-berlin.de...[color=blue]
> RWC wrote:[color=green]
>> 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'[/color]
>
> opener.document.style.backgroundColor = "#FFE4C4";
> //bisque == #FFE4C4 == 255,228,196
>[color=green]
>> window.opener.location.reload()[/color]
>
> opener.location.reload(true);
>[color=green]
>> window.close()[/color]
>
> 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.
>[color=green]
>> }
>>
>> 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
>>[/color]
>
> What was not working? Can you provide an url where the problem is?
>
> DU
> --
> The site said to use Internet Explorer 5 or better... so I switched to
> Firefox 1.0.3 :)[/color]


Closed Thread