Parent window and other problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kamyk

    #1

    Parent window and other problem

    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=JavaSc ript type="text/Javascript">

    function otworz()
    {
    newWindow=windo w.open('JavaScr ipt_okno_potomn e.html','noweOk no','toolbar=ye s
    ,location=yes,s crollbars=yes,w idth=300,height =200');
    }

    </SCRIPT>
    </HEAD>

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

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

    <HTML>
    <HEAD>

    <SCRIPT Language=JavaSc ript type="text/Javascript">

    function aktualizujParen t(TwojeImie)
    {
    opener.document .formularzWy.te kstPowitanie.va lue=twojeImie.v alue;
    }
    </SCRIPT>

    </HEAD>

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

    </BODY>
    </HTML>



  • Kamyk

    #2
    Re: Parent window and other problem

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

    second window
    <HTML>
    <HEAD>

    <SCRIPT Language=JavaSc ript type="text/Javascript">

    function aktualizujParen t()
    {
    opener.document .formularzWy.te kstPowitanie.va lue=document.fo rms('formularzy k
    ').elements('Kl awisz').value;
    }
    </SCRIPT>

    </HEAD>

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

    </BODY>
    </HTML>

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

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

    function otworz()
    {
    newWindow=windo w.open('JavaScr ipt_okno_potomn e.html','noweOk no','toolbar=ye s
    ,location=yes,s crollbars=yes,w idth=300,height =200');
    }

    </SCRIPT>
    </HEAD>

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

    </BODY>
    </HTML>


    Comment

    Working...