I Need Javascript help!

oab

New Member
Messages
918
Reaction score
0
Points
0
hi, i cant figure out why this doesnt work:

index.html
Code:
[LEFT]
[COLOR=#000080]<html>[/COLOR]
[COLOR=#000080]<head>[/COLOR]
[COLOR=#800000]<script type=[COLOR=#0000ff]"text/javascript"[/COLOR]>[/COLOR]
function includescript(sourcefile){
var scriptNode = document.createElement('script');
scriptNode.type = 'text/javascript';
scriptNode.src = sourcefile; 
document.getElementsByTagName("head")[0].appendChild(scriptNode);
}
onload=function(){includescript('main.js')}
[COLOR=#800000]</script>[/COLOR]
[COLOR=#000080]</head>[/COLOR]
[COLOR=#000080]<body>[/COLOR]
	[COLOR=#000080]<div id=[COLOR=#0000ff]"login"[/COLOR]>[/COLOR]loading...[COLOR=#000080]</div>[/COLOR]
[COLOR=#000080]</body>[/COLOR]
[COLOR=#000080]</html>[/COLOR][/LEFT]
main.js
Code:
includescript('functions.js');

if (document.getElementById('login')){
document.getElementById('login').innerHTML = '<script type="text\/javascript" src="loginform.js"><\/script>';
}else{
alert('You must create a login div!');		
}
loginform.js
Code:
document.write('it works!');

the problem is that main.js does not include functions.js OR change the login div to display it works!....


nvm i got it...
 
Last edited:
Top