Is-it possible to write in a mother window from a child window ?

Discussion in 'Javascript' started by orion30, Apr 24, 2005.

  1. orion30

    orion30 Guest

    Is-it possible to write in a mother window from a child window ?
    Like this:
    Parent.document.write(............................................)
     
    orion30, Apr 24, 2005
    #1
    1. Advertisements

  2. orion30

    Grant Wagner Guest

    "orion30" <> wrote in message
    news:426bc0bb$0$18774$...
    > Is-it possible to write in a mother window from a child window ?
    > Like this:
    > Parent.document.write(............................................)


    Why not try it and report back to us whether it worked or not?

    <script type="text/javascript">
    window.newWindowHtml = [
    '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
    '<html>',
    '<head>',
    '<title>Test Window</title>',
    '</head>',
    '<body onload="opener.document.write(\'hi there\');">',
    '</body>',
    '</html>'
    ].join('\n');
    window.open('javascript:eek:pener.newWindowHtml');
    </script>

    Apparently it does work.

    --
    Grant Wagner <>
    comp.lang.javascript FAQ - http://jibbering.com/faq
     
    Grant Wagner, Apr 28, 2005
    #2
    1. Advertisements

  3. Grant Wagner wrote:

    > <script type="text/javascript">
    > window.newWindowHtml = [
    > '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">',
    > '<html>',
    > '<head>',
    > '<title>Test Window</title>',
    > '</head>',
    > '<body onload="opener.document.write(\'hi there\');">',
    > '</body>',
    > '</html>'
    > ].join('\n');
    > window.open('javascript:eek:pener.newWindowHtml');
    > </script>
    >
    > Apparently it does work.


    However it should not :) You forgot to escape the ETAGO delimiters, hence
    it is not Valid HTML. And one also should specify the system identifier
    in a DOCTYPE declaration rather than either assuming the UA will use a
    reference file or force it into Quirks/Compatibility Mode. It would be
    also useful to specify the default scripting language for event handler
    attributes no matter if some UAs tested with do not care about that.


    PointedEars
     
    Thomas 'PointedEars' Lahn, May 25, 2005
    #3
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bhchng
    Replies:
    0
    Views:
    799
    bhchng
    Jan 13, 2004
  2. Sebastien
    Replies:
    1
    Views:
    634
    Michael Borgwardt
    Nov 7, 2003
  3. Jeff Rodriguez
    Replies:
    23
    Views:
    1,565
    David Schwartz
    Dec 9, 2003
  4. VisionSet

    Mother of a Refactor

    VisionSet, Jul 31, 2006, in forum: Java
    Replies:
    11
    Views:
    793
    Luke Webber
    Aug 1, 2006
  5. VisionSet
    Replies:
    3
    Views:
    410
    VisionSet
    Aug 8, 2006
  6. Blue®
    Replies:
    4
    Views:
    1,219
    Blue®
    Sep 27, 2003
  7. Replies:
    1
    Views:
    430
  8. Spammay Blockay
    Replies:
    1
    Views:
    697
    Dietmar Meier
    Feb 4, 2005
Loading...