Hi,
dynamically load of javascript file :
function createScriptTag()
{
var head = document.getElementsByTagName('head').item(0)
scriptTag = document.createElement('script');
scriptTag.setAttribute("language","javascript"
head.appendChild(scriptTag)
scriptTag.setAttribute("src","test.js"
}
if in test.js I have :
function test()
{
alert('test');
}
alert('ok');
test();
the two alert pop the message when I execute createScriptTag(), but if I call test() afer the call of createScriptTag() I have an error message. Why ?
Thanks
dynamically load of javascript file :
function createScriptTag()
{
var head = document.getElementsByTagName('head').item(0)
scriptTag = document.createElement('script');
scriptTag.setAttribute("language","javascript"
head.appendChild(scriptTag)
scriptTag.setAttribute("src","test.js"
}
if in test.js I have :
function test()
{
alert('test');
}
alert('ok');
test();
the two alert pop the message when I execute createScriptTag(), but if I call test() afer the call of createScriptTag() I have an error message. Why ?
Thanks