Loading ...
Sorry, an error occurred while loading the content.

Re: [ydn-javascript] Re: Off-topic: invoking JavaScript on Center layout loaded

Expand Messages
  • Satyam
    I remember that a few days ago you were happy to find the solution to your problem. I thought, he found one solution which will bring him plenty more
    Message 1 of 4 , Jan 6, 2009
    • 0 Attachment
      I remember that a few days ago you were happy to find the <iframe>
      solution to your problem. I thought, he found one solution which will
      bring him plenty more troubles shortly, and it has.

      If you go back to that decision you might try the following. Forget
      about placing actual hyperlinks in the tree, use the techniques
      described in:

      http://developer.yahoo.com/yui/treeview/#customproperties
      http://developer.yahoo.com/yui/treeview/#events

      So, store the link, or some data that might let you assemble it, as
      custom data. Listen to clickEvent on the node, recover that custom
      information and call asyncRequest to fetch that information. Insert the
      data received in the response into the innerHTML of the center panel.
      The inserted string should not be a full HTML document but a segment, it
      should not have <html>, <head> or <body> tags.


      BTW, it is quite normal that you find an answer yourself once you ask
      others. When writing the question you have to state your problem clearly
      for others to understand, that usually brings more clarity to your own
      thoughts and the answer comes easily. That's what shrinks do all the
      time, they just let you talk, at least that is one simple technique they
      use.

      Satyam


      cjavajim wrote:
      >
      > --- In ydn-javascript@yahoogroups.com, "cjavajim" <cjavajim@...> wrote:
      > >
      > > I've used Layout Manager to create Left, Center, and Right layouts.
      > >
      > > The Left layout contains a TreeView with text and HTML nodes. Clicking
      > > a n (HTML node) item in the TreeView opens a HTML document in the
      > > Center layout. The TreeView markup is like this example:
      > >
      > > {type:'html', html:'<a href="./example.html"
      > target="center">Example</a>'}
      > >
      > > (Aside: I know I could have used a text node for this--except that I'm
      > > not showing the remainder of the HTML for an <img> tag.)
      > >
      > > And the HTML markup for the Center layout is:
      > >
      > > <div id="center"><iframe id="cif" name="c" width="100%"
      > > height="100%"></iframe></div>
      > >
      > > This works as-is when the Center layout is to contain a "static" HTML
      > > documents such as example.html in the <a> above.
      > >
      > > Now I have to do some voodoo to the HTML document in the Center layout
      > > after it has loaded. I just can't figure out how to invoke my
      > > JavaScript code (which I know works)--so would someone show me how to
      > > invoke my JavaScript code once the Center layout gets a new HTML
      > > document? Thank you!
      > >
      >
      > --- In ydn-javascript@yahoogroups.com, "cjavajim" <cjavajim@...> wrote:
      > >
      > > I've used Layout Manager to create Left, Center, and Right layouts.
      > >
      > > The Left layout contains a TreeView with text and HTML nodes. Clicking
      > > a n (HTML node) item in the TreeView opens a HTML document in the
      > > Center layout. The TreeView markup is like this example:
      > >
      > > {type:'html', html:'<a href="./example.html"
      > target="center">Example</a>'}
      > >
      > > (Aside: I know I could have used a text node for this--except that I'm
      > > not showing the remainder of the HTML for an <img> tag.)
      > >
      > > And the HTML markup f or the Center layout is:
      > >
      > > <div id="center"><iframe id="cif" name="c" width="100%"
      > > height="100%"></iframe></div>
      > >
      > > This works as-is when the Center layout is to contain a "static" HTML
      > > documents such as example.html in the <a> above.
      > >
      > > Now I have to do some voodoo to the HTML document in the Center layout
      > > after it has loaded. I just can't figure out how to invoke my
      > > JavaScript code (which I know works)--so would someone show me how to
      > > invoke my JavaScript code once the Center layout gets a new HTML
      > > document? Thank you!
      > >
      >
      > Well, it seems that this ol' server-side programmer can learn
      > client-side stuff after all. After many hours and failed attempts I
      > finally found what I was looking for: 'onload'
      >
      > <div id="center"><iframe id="cif" name="c" width="100%" height="100%"
      > onload="iframe_loaded();"></iframe></div>
      >
      > All's well.
      >
      > P.S. After hours of trying, why is it that after posting a question I
      > seem to find the answer straightaway?
      >
      >
      > ------------------------------------------------------------------------
      >
      >
      > No virus found in this incoming message.
      > Checked by AVG - http://www.avg.com
      > Version: 8.0.176 / Virus Database: 270.10.2/1876 - Release Date: 05/01/2009 9:44
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.