Parent window and other problem

K

Kamyk

Hello all!

Is there anybody who could help me. I have rewritten a code straigth from
the
book including a little bti of modifications, but unfortunately this code
doesn`t work.
I would like to create a main window, where after clicking on the button,
there
will be opened second window, where I will fill some string and after
clicking on
the ENTER key, this name value would be sent to the main window.
Where is the error in the following codes?

Thank you in advance
Marcin from Poland

----------------------------------------------------
parent window:

<HTML>
<HEAD>
<SCRIPT Language=JavaScript type="text/Javascript">

function otworz()
{
newWindow=window.open('JavaScript_okno_potomne.html','noweOkno','toolbar=yes
,location=yes,scrollbars=yes,width=300,height=200');
}

</SCRIPT>
</HEAD>

<BODY>
<H1>Witamy na stronie</H1>
<FORM name=formularzWy>
<INPUT type=text size=20 name="tekstPowitanie" value="">
<INPUT type=button name=kliczek onClick="otworz();" value="">
</FORM>

</BODY>
</HTML>
----------------------------------------------------
second window:

<HTML>
<HEAD>

<SCRIPT Language=JavaScript type="text/Javascript">

function aktualizujParent(TwojeImie)
{
opener.document.formularzWy.tekstPowitanie.value=twojeImie.value;
}
</SCRIPT>

</HEAD>

<BODY>
<H1> Jak masz na imie?</H1>
<FORM>
<INPUT name="twojeImie" type=text onBlur="aktualizujParent(this);" size=20>
</FORM>

</BODY>
</HTML>
 
K

Kamyk

I have fix the problem myself.
Here is a right code including some idea modyfications:

second window
<HTML>
<HEAD>

<SCRIPT Language=JavaScript type="text/Javascript">

function aktualizujParent()
{
opener.document.formularzWy.tekstPowitanie.value=document.forms('formularzyk
').elements('Klawisz').value;
}
</SCRIPT>

</HEAD>

<BODY>
<H1> Jak masz na imie?</H1>
<FORM name=formularzyk>
<INPUT type="text" name="Klawisz" size=20>
<INPUT type="button" name="cos" onClick="aktualizujParent()"
value="Przeslij">
</FORM>

</BODY>
</HTML>

----------------------------------------------------------------------------
----
parent window:

<HTML>
<HEAD>
<SCRIPT Language=JavaScript type="text/Javascript">

function otworz()
{
newWindow=window.open('JavaScript_okno_potomne.html','noweOkno','toolbar=yes
,location=yes,scrollbars=yes,width=300,height=200');
}

</SCRIPT>
</HEAD>

<BODY>
<H1>Witamy na stronie</H1>
<FORM name=formularzWy>
<INPUT type=text size=20 name="tekstPowitanie" value="">
<INPUT type=button name=kliczek onClick="otworz();" value="">
</FORM>

</BODY>
</HTML>
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top