ik probeer een js import te maken, heb dit op de volgende manier gedaan:
index.php
<html>
<head>
</head>
<body>
<span id="JS_FILE_LIST">
</span>
<script type="text/javascript" src="init.conf.js"></script>
<script type="text/javascript">
$import('Test') ;
</script>
</body>
</html>
init.conf.js
function $import(File)
{
var script = document.createElement('script') ;
script.type = 'text/javascript' ;
script.src = File+'.class.js' ;
document.getElementById('JS_FILE_LIST').appendChild(script);
eval('var cls'+File+' = '+(new String(File+'()'))+';');
eval('cls'+File+'.init()');
}
Test.class.js
var Test = function()
{
this.init = function()
{
},
this.doe = function()
{
alert('ik ga al') ;
}
}
Nu krijg ik alleen elke keer de error 'Test is undefined'...
Zit er al een poosje naar te staren maar zie het even niet... Iemand hier die het foutje wel ziet?