asdf

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christopher Benson-Manica

    #1

    asdf

    I'm trying to create script that can dynamically execute script from a
    given source and then call a callback function when complete. I have
    the following...

    function bar() {
    alert( 'bar' );
    }
    function foo() {
    var s=document.getE lementById( 'dynamicScriptE lement' );
    if( !s ) {
    s=document.crea teElement( 'script' );
    s.type='text/javascript';
    s.id='dynamicSc riptElement';
    document.docume ntElement.child Nodes[1].appendChild( s );
    }
    s.src='test.js' ;
    bar();
    }

    1) Is the script in test.js guaranteed to be executed before bar() is
    called?
    2) foo() assumes that the <html> element has a <head> and <body> -
    presumably that's reasonable, right?
    3) Any other comments would be appreciated!

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cybers pace.org | don't, I need to know. Flames welcome.
  • Christopher Benson-Manica

    #2
    [OT] - Please ignore the asdf thread

    Christopher Benson-Manica <ataru@nospam.c yberspace.org> spoke thus:
    [color=blue]
    > I'm trying to create script that can dynamically execute script from a
    > given source and then call a callback function when complete. I have
    > the following...[/color]

    I screwed up the subject of this post and so I have reposted with a more
    appropriate subject. Sorry.

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cybers pace.org | don't, I need to know. Flames welcome.

    Comment

    Working...