Writing to an iFrame

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dennis M. Marks

    Writing to an iFrame

    I have an existing page that dynamically creates data in a popup
    window. I am trying to change it to use an iFrame. Is the following
    code valid:

    The iFrame is as follows
    <iframe src="theframe.h tml" name="theframe" ></iframe>
    "theframe.h tml" is an existing file initially with instructions.

    In a script I do
    thewindow=windo w.open("","thef rame");
    thewindow.docum ent.open();
    thewindow.docum ent.write("Some Requested Data");
    thewindow.docum ent.close();

    This is done multiple times depending on what the user requests each
    time. Sometimes this works and sometimes it doesn't. I'm probably doing
    someing very wrong but I don't know where to look for reference.

    I'm not really opening a window so there must be another way to do it.

    What is the best way to write to an iFrame or should I not even try?

    --
    Dennis M. Marks


    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • Lasse Reichstein Nielsen

    #2
    Re: Writing to an iFrame

    "Dennis M. Marks" <denmarks@dcsi. net> writes:
    [color=blue]
    > <iframe src="theframe.h tml" name="theframe" ></iframe>[/color]
    [color=blue]
    > In a script I do
    > thewindow=windo w.open("","thef rame");
    > thewindow.docum ent.open();
    > thewindow.docum ent.write("Some Requested Data");
    > thewindow.docum ent.close();[/color]
    [color=blue]
    > This is done multiple times depending on what the user requests each
    > time. Sometimes this works and sometimes it doesn't.[/color]

    Bugger! I hate it when it does that.
    Do you see any error messages? Do you have error messages turned on?
    It could be that the url "" isn't accepted as coming from the same
    domain as your page.
    [color=blue]
    > I'm not really opening a window so there must be another way to do it.[/color]

    Try
    var thewindow = window.frames['theframe'];
    instead of window.open.
    [color=blue]
    > What is the best way to write to an iFrame or should I not even try?[/color]

    I would use the frames collection instead of window.open, but otherwise
    it looks fine.

    /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

    • @SM

      #3
      Re: Writing to an iFrame

      "Dennis M. Marks" a ecrit :
      [color=blue]
      > I have an existing page that dynamically creates data in a popup
      > window. I am trying to change it to use an iFrame. Is the following
      > code valid:
      >
      > The iFrame is as follows
      > <iframe src="theframe.h tml" name="theframe" ></iframe>
      > "theframe.h tml" is an existing file initially with instructions.
      >
      > In a script I do
      > thewindow=windo w.open("","thef rame");[/color]

      thewindow=paren t.theframe;
      or
      thewindow=paren t.frames['theframe'];

      or (if page is in a framed page, itself in a fram of main page)
      thewindow=top.t heframe;
      [color=blue]
      > thewindow.docum ent.open();
      > thewindow.docum ent.write("Some Requested Data");
      > thewindow.docum ent.close();[/color]

      variant :
      TW = parent.theframe .document;
      TW.open();
      TW.write("Some Requested Data");
      TW.close();


      --
      *************** *************** *************** *************** **
      Stéphane MORIAUX : mailto:stephane OTER-MOImoriaux@wana doo.fr
      Aide aux Pages Perso (images & couleurs, formulaire, CHP, JS)

      *************** *************** *************** *************** **


      Comment

      Working...