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

onContentReady / onDOMReady complaints

Expand Messages
  • Brian McCullough
    Folks, I have a page that I am trying to render, where I need to create an Overlay or Panel from HTML markup. I have done this several times in the past,
    Message 1 of 3 , Dec 6, 2008
    • 0 Attachment
      Folks,

      I have a page that I am trying to render, where I need to create an
      Overlay or Panel from HTML markup. I have done this several times in
      the past, without serious issues.

      However, in this case, the difference seems to be YUI Loader. I am
      running 2.5.2, and the page structure is like:

      HTML
      Head
      Load YUI Loader
      Use YUI Loader to load CSS
      End Head
      Body
      DIV id=x
      DIV id=Y_div
      DIV id=bd
      Panel content
      End DIV
      End DIV
      Lots more content
      End DIV
      Use YUI Loader to load JS

      Script Tag
      var ts_panel_init = function() {
      var mypanel = new YAHOO.widget.Overlay( Y_div, {
      close: false,
      height: '31px',
      xy: [ 5, 5 ],
      constraintoviewport: true,
      visible: true
      } );
      mypanel.setHeader( "" );
      mypanel.setFooter( "" );
      mypanel.render();
      }
      YAHOO.util.Event.onContentReady( Y_div, ts_panel_init );
      End Script
      End Body
      End HTML


      I have tried both onDOMReady and onContentReady, and in both cases I get
      complaints about Y_div not being defined. What am I doing wrong?


      Thanks,
      Brian
    • Satyam
      I guess that when you write Y_div you mean Y_div . If you get, literally, Y_div = YAHOO.util.Dom.get( Y_div ) then the resulting Y_div might contain a
      Message 2 of 3 , Dec 6, 2008
      • 0 Attachment
        I guess that when you write Y_div you mean "Y_div". If you get,
        literally, Y_div = YAHOO.util.Dom.get("Y_div") then the resulting Y_div
        might contain a reference or null if not found at the time of getting.
        From then on, nothing would work. Otherwise, it looks good so, my
        second step would be to run JSLint on it, tidyHTML, the YUI compressor
        and pay attention to see if any of them pick something that I might have
        missed.

        Satyam


        Brian McCullough wrote:
        > Folks,
        >
        > I have a page that I am trying to render, where I need to create an
        > Overlay or Panel from HTML markup. I have done this several times in
        > the past, without serious issues.
        >
        > However, in this case, the difference seems to be YUI Loader. I am
        > running 2.5.2, and the page structure is like:
        >
        > HTML
        > Head
        > Load YUI Loader
        > Use YUI Loader to load CSS
        > End Head
        > Body
        > DIV id=x
        > DIV id=Y_div
        > DIV id=bd
        > Panel content
        > End DIV
        > End DIV
        > Lots more content
        > End DIV
        > Use YUI Loader to load JS
        >
        > Script Tag
        > var ts_panel_init = function() {
        > var mypanel = new YAHOO.widget.Overlay( Y_div, {
        > close: false,
        > height: '31px',
        > xy: [ 5, 5 ],
        > constraintoviewport: true,
        > visible: true
        > } );
        > mypanel.setHeader( "" );
        > mypanel.setFooter( "" );
        > mypanel.render();
        > }
        > YAHOO.util.Event.onContentReady( Y_div, ts_panel_init );
        > End Script
        > End Body
        > End HTML
        >
        >
        > I have tried both onDOMReady and onContentReady, and in both cases I get
        > complaints about Y_div not being defined. What am I doing wrong?
        >
        >
        > Thanks,
        > Brian
        >
        >
        >
        > ------------------------------------
        >
        > Yahoo! Groups Links
        >
        >
        >
        > ------------------------------------------------------------------------
        >
        >
        > No virus found in this incoming message.
        > Checked by AVG - http://www.avg.com
        > Version: 8.0.176 / Virus Database: 270.9.14/1832 - Release Date: 05/12/2008 9:57
        >
        >
      • Brian McCullough
        ... Actually, you ve hit it. I wasn t thinking that I should be using a quoted string there, that was it. I was misreading the code that I was copying. So
        Message 3 of 3 , Dec 6, 2008
        • 0 Attachment
          On Sat, Dec 06, 2008 at 06:14:42PM +0100, Satyam wrote:
          > I guess that when you write Y_div you mean "Y_div". If you get,

          Actually, you've hit it. I wasn't thinking that I should be using a
          quoted string there, that was it. I was misreading the code that I was
          copying. So often we see what we assume, instead of what is actually
          there.

          Thank you again, Satyam.

          Brian
        Your message has been successfully submitted and would be delivered to recipients shortly.