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

How to include javascript inside a Panel

Expand Messages
  • dougwdiego
    How do I execute javascript inside of a Yahoo Panel? For example the following code does not work: // Initialize the temporary Panel to display while waiting
    Message 1 of 1 , Dec 6, 2007
    • 0 Attachment
      How do I execute javascript inside of a Yahoo Panel?

      For example the following code does not work:

      // Initialize the temporary Panel to display while waiting for external content to load
      YAHOO.example.container.wait =
      new YAHOO.widget.Panel("wait",
      { width: "750px",
      fixedcenter: true,
      close: false,
      draggable: false,
      modal: true,
      zindex:9,
      visible: false
      }
      );

      YAHOO.example.container.wait.setHeader("Example");
      YAHOO.example.container.wait.setBody("<script type=\"text/javascript\">alert(\"Hello
      World Alert\");<\/script>Hello World Body");
      YAHOO.example.container.wait.render(document.body);

      It does not execute the "alert()" function.

      My use case, is that I want to run a JSON Datatable inside of a Panel. The javascript to load
      the datatable is not being executed.

      The text that I'm loading into setBody is coming from a
      YAHOO.Util.connect.asyncRequest(...) call

      It's not an option to put the javascript outside of the setBody() call because I don't want it
      loaded on every page. Only if a user clicks on the panel, do I want to load the data.

      Thanks for any help!
    Your message has been successfully submitted and would be delivered to recipients shortly.