Object tag to write HTML page to via JavaScript?

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

    #1

    Object tag to write HTML page to via JavaScript?

    Object tag to write HTML page to via JavaScript?

    I've used iFrames and Objects to load web pages into another page.
    I want to do similar but not load a uri, rather write the page, <HTML>
    ....to...</HTML> via a JavaScript function.
    Is this possible with either of these two tags?

    Thanks,

    gsb


  • Lasse Reichstein Nielsen

    #2
    Re: Object tag to write HTML page to via JavaScript?

    "gsb" <gsb@QWest.ne t> writes:
    [color=blue]
    > Object tag to write HTML page to via JavaScript?
    >
    > I've used iFrames and Objects to load web pages into another page.
    > I want to do similar but not load a uri, rather write the page, <HTML>
    > ...to...</HTML> via a JavaScript function.
    > Is this possible with either of these two tags?[/color]

    Use an iframe.
    ---
    <iframe id="foo" name="foo"></iframe>

    <script type="text/javascript">
    function writeDoc() {
    var doc = frames['foo'].document;
    doc.open();
    doc.write("<!DO CTYPE ... ><html> ....funny content! </html>");
    doc.close();
    }
    </script>
    <input type="button" value="insert" onclick="writeD oc()">
    ---
    Tested in IE 6, Mozilla FB and Opera 7.
    Mozilla is the one that requires the name attribute on the iframe
    in order to access it through the frames collection.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • gsb

      #3
      Re: Object tag to write HTML page to via JavaScript?

      Does that work with an object, or just an iFrame?

      Thanks again,

      gsb

      "Lasse Reichstein Nielsen" <lrn@hotpop.com > wrote in message
      news:oetga8ha.f sf@hotpop.com.. .[color=blue]
      > "gsb" <gsb@QWest.ne t> writes:
      >[color=green]
      > > Object tag to write HTML page to via JavaScript?
      > >
      > > I've used iFrames and Objects to load web pages into another page.
      > > I want to do similar but not load a uri, rather write the page, <HTML>
      > > ...to...</HTML> via a JavaScript function.
      > > Is this possible with either of these two tags?[/color]
      >
      > Use an iframe.
      > ---
      > <iframe id="foo" name="foo"></iframe>
      >
      > <script type="text/javascript">
      > function writeDoc() {
      > var doc = frames['foo'].document;
      > doc.open();
      > doc.write("<!DO CTYPE ... ><html> ....funny content! </html>");
      > doc.close();
      > }
      > </script>
      > <input type="button" value="insert" onclick="writeD oc()">
      > ---
      > Tested in IE 6, Mozilla FB and Opera 7.
      > Mozilla is the one that requires the name attribute on the iframe
      > in order to access it through the frames collection.
      >
      > /L
      > --
      > Lasse Reichstein Nielsen - lrn@hotpop.com
      > DHTML Death Colors:[/color]
      <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>[color=blue]
      > 'Faith without judgement merely degrades the spirit divine.'[/color]


      Comment

      • Lasse Reichstein Nielsen

        #4
        Re: Object tag to write HTML page to via JavaScript?

        "gsb" <gsb@QWest.ne t> writes:

        Please don't top post.
        [color=blue]
        > Does that work with an object, or just an iFrame?[/color]

        Probably only with iframes. It accesses the document object
        of the embedded page throught the frames collection.

        I don't have much experience with objects, but my impression is
        that pages embedded with the object tag are not easily accessible
        through scripting - because the object can hold so many different
        types of data, there is no simple way to access the data that is
        there.

        /L
        --
        Lasse Reichstein Nielsen - lrn@hotpop.com
        DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
        'Faith without judgement merely degrades the spirit divine.'

        Comment

        • gsb

          #5
          Re: Object tag to write HTML page to via JavaScript?

          I appreciate your patience, but I'm not sure what "Please don't top post."
          means.
          Please explain. I apologies for my ignorance regarding the posting.

          I like the simplicity of your solution, but it did not work in Netscape (I
          have 7.1)
          That is why I asked about the object tag.

          Thanks,

          gsb


          "gsb" <gsb@QWest.ne t> wrote in message
          news:CiIKb.161$ Gw4.54442@news. uswest.net...[color=blue]
          > Object tag to write HTML page to via JavaScript?
          >
          > I've used iFrames and Objects to load web pages into another page.
          > I want to do similar but not load a uri, rather write the page, <HTML>
          > ...to...</HTML> via a JavaScript function.
          > Is this possible with either of these two tags?
          >
          > Thanks,
          >
          > gsb
          >
          >[/color]


          Comment

          • Lasse Reichstein Nielsen

            #6
            Re: Object tag to write HTML page to via JavaScript?

            "gsb" <gsb@QWest.ne t> writes:
            [color=blue]
            > I appreciate your patience, but I'm not sure what "Please don't top
            > post." means. Please explain. I apologies for my ignorance
            > regarding the posting.[/color]

            Top posting refers to the practice of putting ones entire reply at
            the top of the message, and including the entire previous message
            below. It is a bad idea for several reasons.

            1) Readability. While this can ofcourse be argued, a majority of
            newsgroup users prefer to see the context of a reply before the reply.
            Splitting the replies to different parts of the previous message up,
            also makes it easier to see which reply replies to which part.

            2) Bandwidth. Including the entire previous message below is a waste
            of bandwidth. While a single message won't kill anyone, not even
            people reading news on a modem and paying by the minute, if two people
            both use this quoting style in reply to each other, the quotes would
            quickly become huge (each message including the *entire* history of
            the discussion). It is recommended to quote only the parts of the
            previous message that are needed to give context to your reply.
            Keeping quotes from even earlier messages is rarely improtant,
            and should be kept to a minimum.
            (Not quoting anything is also bad, because you completely lose the
            context).

            3) Structure. The standard for messages specifies a separator between
            the message and the signature (minus-minus-space on a line of its
            own). Message readers recognize this divider, and treats the part
            below it specially. By writing the reply at the top, the entire quoted
            message now appears below the signature separator, which can be highly
            confuzing to both people and newsclients. The only advantage is that
            clients should cut the signature before replying, potentially avoiding
            the extra quoting. Sadly, not all clients does this.

            Thank you for asking :)
            [color=blue]
            > I like the simplicity of your solution, but it did not work in Netscape (I
            > have 7.1)[/color]

            It works for me in Netscape 7.1 (freshly installed - damn them for
            installing AOL without my permission!).
            [color=blue]
            > That is why I asked about the object tag.[/color]

            Actually, in Netscape 7.1 it seems to work with object instead of iframe.
            It doesn't in Opera or IE, though.

            /L
            --
            Lasse Reichstein Nielsen - lrn@hotpop.com
            DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
            'Faith without judgement merely degrades the spirit divine.'

            Comment

            • gsb

              #7
              Re: Object tag to write HTML page to via JavaScript?

              Thank you for responding.
              My internet express auto add that stuff in the reply.

              Anyway, here's what I came up with:

              function doWrite() {
              var doc=null, obj=document.ge tElementById( "myID" );
              if(obj.contentD ocument) doc=obj.content Document;
              else if(obj.contentW indow) doc=obj.content Window.document ;
              else if(obj.document ) doc=obj.documen t;
              // else I'm scewed - LOL
              ...
              str = "whatever";
              ...
              doc.open();
              doc.write(str);
              doc.close();
              }

              Works in IE6 and Netscape 7.1; don't know about the others.

              Thanks for your help and patience.

              gsb


              Comment

              • HikksNotAtHome

                #8
                Re: Object tag to write HTML page to via JavaScript?

                In article <fzesa5g1.fsf@h otpop.com>, Lasse Reichstein Nielsen <lrn@hotpop.com >
                writes:
                [color=blue][color=green]
                >> I like the simplicity of your solution, but it did not work in Netscape (I
                >> have 7.1)[/color]
                >
                >It works for me in Netscape 7.1 (freshly installed - damn them for
                >installing AOL without my permission!).[/color]

                AOL or AIM? NS7 comes with the AOL IM service but I have never known it to
                install the full blown AOL application.
                --
                Randy

                Comment

                • Dr John Stockton

                  #9
                  Re: Object tag to write HTML page to via JavaScript?

                  JRS: In article <UVLKb.88$Uq6.5 0358@news.uswes t.net>, seen in
                  news:comp.lang. javascript, gsb <gsb@QWest.ne t> posted at Tue, 6 Jan 2004
                  20:31:25 :-[color=blue]
                  >Thank you for responding.
                  >My internet express auto add that stuff in the reply.[/color]

                  You chose to use it; it is for you to deal with its defects.

                  Before posting, it is advisable to read the FAQ with care.

                  --
                  © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
                  <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
                  <URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
                  <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.

                  Comment

                  • Lasse Reichstein Nielsen

                    #10
                    Re: Object tag to write HTML page to via JavaScript?

                    hikksnotathome@ aol.com (HikksNotAtHome ) writes:
                    [color=blue]
                    > AOL or AIM? NS7 comes with the AOL IM service but I have never known it to
                    > install the full blown AOL application.[/color]

                    Actually, just an advertisment for AOL. I was thinking of AIM, but it
                    seems it worked to deselect it before installation. So, no that damn
                    was not deserved. Now they just get one for putting advertising on my
                    desktop :)

                    /L
                    --
                    Lasse Reichstein Nielsen - lrn@hotpop.com
                    DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                    'Faith without judgement merely degrades the spirit divine.'

                    Comment

                    • Thomas 'PointedEars' Lahn

                      #11
                      Re: Object tag to write HTML page to via JavaScript?

                      Lasse Reichstein Nielsen wrote:[color=blue]
                      > It works for me in Netscape 7.1 (freshly installed - damn them for
                      > installing AOL without my permission!).[/color]

                      You are looking for http://www.holgermetzger.de/compactfaq.html


                      HTH

                      PointedEars

                      Comment

                      • Thomas 'PointedEars' Lahn

                        #12
                        Re: Object tag to write HTML page to via JavaScript?

                        Lasse Reichstein Nielsen wrote:
                        [color=blue]
                        > It works for me in Netscape 7.1 (freshly installed -
                        > damn them for installing AOL without my permission!).[/color]

                        You are looking for http://holgermetzger.de/net7compd.html
                        (other language packs are available).


                        HTH

                        PointedEars

                        Comment

                        • Lasse Reichstein Nielsen

                          #13
                          Re: Object tag to write HTML page to via JavaScript?

                          Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:
                          [color=blue]
                          > You are looking for http://holgermetzger.de/net7compd.html
                          > (other language packs are available).[/color]

                          Does the page come in other languages too? :)
                          (Well, I can read German, it's just neither fast nor precise :)

                          I usually use Firebird anyway, so I'm not going to worry too much
                          about Netscape.
                          /L
                          --
                          Lasse Reichstein Nielsen - lrn@hotpop.com
                          DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
                          'Faith without judgement merely degrades the spirit divine.'

                          Comment

                          • Thomas 'PointedEars' Lahn

                            #14
                            Re: Object tag to write HTML page to via JavaScript?

                            Lasse Reichstein Nielsen wrote:
                            [color=blue]
                            > Thomas 'PointedEars' Lahn <PointedEars@we b.de> writes:[color=green]
                            >> You are looking for http://holgermetzger.de/net7compd.html
                            >> (other language packs are available).[/color]
                            >
                            > Does the page come in other languages too? :)[/color]

                            If you like

                            <http://translate.googl e.com/translate?u=htt p://holgermetzger.d e/net7compd.html& langpair=de|en& hl=en&ie=Unknow n&oe=ISO-8859-1>

                            it does ;-)


                            PointedEars

                            Comment

                            Working...