Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, dynamically load of javascript

Status
Not open for further replies.

Izzac

Programmer
Jan 26, 2001
20
CA
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

 
ok, forget it!
the problem its me.....this work very fine!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top