Yichz
Yichz

Reputation: 9671

dojo: how to execute javascript functions of a page which is loaded by contentPane

I have following pages:

popup.html

<script type="text/javascript">
//requires
function doFunction(){
    alert("hi");
}
</script>
<button dojoType="dijit.form.Button" type="button" onClick="doFunction()">Click me</button>

main.html

    <script type="text/javascript">
    function showPopUp(){
        theContentPane.set("Href", "popup.html");
        theModal.show();

    }
    </script>
        <div dojoType="dijit.Dialog" jsId="theModal">
            <div dojoType="dojox.layout.ContentPane" jsId="theContentPane">

            </div>      
        </div>
<button dojoType="dijit.form.Button" type="button" onClick="showPopUp()">open popup</button>

when I press the button "open popup" in main.html the pop opened, and everything seems to be fine. but when I pression the button of the popup "click me" firebug shows: doFunction is not defined

is it problem of scope? how can I make the popup.html call funciones which is inside popup.html

Upvotes: 1

Views: 3518

Answers (2)

Yichz
Yichz

Reputation: 9671

after I post it found the answer.... the code I posted actually works, mine didn't work because I had

dijit.layout.ContentPane

instead of

dojox.layout.ContentPane

since dijit.layout.ContentPanel does instantiate dojo widgets but does not execute javascripts and dojox.layout.ContentPane does...

Upvotes: 1

natedavisolds
natedavisolds

Reputation: 4295

I don't work with dojo, but it seems like the js in the popup.html isn't initiated. Put the script tag that is in the popup.html in the main.html and it should work.

Upvotes: 0

Related Questions