call function with dijit.layout.ContentPane onload?

3.6k Views Asked by At

Is it call test() of sub.htm from index.htm by this code when doing very?

Thank you very much.

index.htm

<div dojoType="dijit.layout.ContentPane" id="subFrame"  region="left" href="sub.htm">
<script type="dojo/connect" event="onLoad">
   // this call test()

</script>
</div>

sub.htm

<script type="text/javascript">

  function test() {
    alert("success");
  }

</script>
<table>
  <tr>
    <td></td>
  </tr>
</table>
2

There are 2 best solutions below

0
On BEST ANSWER

For what I know you can't call a javascript inside a content pane unless you use <script type="dojo/method">. try to replace the text/javascript type in sub htm with "dojo/method".

0
On

i think it should be fine if you swap the function into a variable declaration style:

var test = new function(){ alert("success") };