Link to home
Create AccountLog in
JavaScript

JavaScript

--

Questions

--

Followers

Top Experts

Avatar of Evyatar
Evyatar🇮🇱

showModalDialog
How can I control parent window from popup window?

I need by clicking on selected icon to close the window (the one that the showModalDialog opened) and to submit form from the parent window
I can't use window.open instead because I need that the popup window will remain activate or closed.
It can't be on the background!
(I familiar with <body onblur="window.focus()"> but it's not adequateness solve the problem)

Zero AI Policy

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


Avatar of rpimmerrpimmer

try looking into parent.opener values e.g

parent.opener.document.form1.button1.value etc etc

Avatar of EvyatarEvyatar🇮🇱

ASKER

parent.opener is undefined

OK, had it slightly wrong, here is the code that will show you how to use it.

Main.html

<HTML>
<SCRIPT>
window.open("popup.html","Popup");
</SCRIPT>
<FORM NAME=Form1>
<INPUT NAME=Test1 TYPE=TEXT>
</FORM>
</HTML>

popup.html

<HTML>
<SCRIPT>
opener.document.Form1.Test1.value = "Added From Popup";
</SCRIPT>
</HTML>

-Richard

Reward 1Reward 2Reward 3Reward 4Reward 5Reward 6

EARN REWARDS FOR ASKING, ANSWERING, AND MORE.

Earn free swag for participating on the platform.


Avatar of EvyatarEvyatar🇮🇱

ASKER

Now I see what you mean and you absolutely right but it's got nothing to do with my problem cause I can't use window.open() because that window mast remain on top until it's close.
Please read again my first question.
I'm using showModalDialog()

What exactly is it that you want, please paste some code as I am not sure exactly what you want.

Is it you want to open a new window and that window must be in the forground untill closed.

My answer was to the first bit "How can I control parent window from popup window?".

What else do you need to do, will my code combined with <body onblur="window.focus()"> not solve the problem?

-Richard

Avatar of EvyatarEvyatar🇮🇱

ASKER

Richard,
That's exactly what I did wrote in the first place!!
so the answer remain NO! I can't use
<body onblur="window.focus()"> because It's doesn't force the user to close the popup window first.
I'm using showModalDialog to open that window.
but It's all already being wrote on my first request.
thanks again.

Free T-shirt

Get a FREE t-shirt when you ask your first question.

We believe in human intelligence. Our moderation policy strictly prohibits the use of LLM content in our Q&A threads.


ASKER CERTIFIED SOLUTION
Avatar of rpimmerrpimmer

Link to home
membership
Log in or create a free account to see answer.
Signing up is free and takes 30 seconds. No credit card required.
Create Account

Avatar of EvyatarEvyatar🇮🇱

ASKER

Thank u very much!
JavaScript

JavaScript

--

Questions

--

Followers

Top Experts

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.