De bedoeling is om een html editor te maken. we mogen alleen functies aan objecten toevoegen mbv 'prototype'.
Momenteel zit ik met de volgende html code:
HTML Code:
<fieldset>
<legend>Test editor</legend><br />
<div id="testEditor">
</div>
</fieldset>
<script type="text/javascript">
testEditor = new Peditor("testEditor", "blue");
</script>
en de bijhorende javascript code:
Code:
function Peditor( id, template ) {
this.theEditor = document.getElementById(id) ;
this.templateName = template ;
this.loadTemplate();
}
Peditor.prototype.installedTemplates = function( template ) {
var installedTemplates = [
"default",
"blue"
]
if ( installedTemplates.indexOf(this.templateName, 0) != -1 ) {
return true;
} else {
return false ;
}
}
Peditor.prototype.templateExistsToDefault = function () {
if ( ! this.installedTemplates(this.templateName) ) {
this.templateName = "default";
}
} ;
Peditor.prototype.loadTemplate = function() {
this.templateExistsToDefault();
//set editor to a correct size and create border
temp = this.loadTemplateVars();
this.theEditor.style.width = temp[0];
this.theEditor.style.height = temp[1];
this.theEditor.style.border = temp[2];
};
Peditor.prototype.loadTemplateVars = function() {
loadJsFile("js/Peditor/templates/"+this.templateName+".js");
alert("Als deze alert weg is werkt het script niet");
return eval("Peditor_"+this.templateName+"()");
};
alles werkt perfect. totdat ik in Peditor.prototype.loadTemplateVars de alert weghaal, dan doet hij gewoon niets. dit is dus bizar en uiterst vervelend
Heb ook al geprobeerd om een appart object Template() aan te maken en dit dan in een var te proppen in ipv met een return te werken, dit werkt echter ook niet
, zolang dat die alert er niet staat doet hij niets
alvast bedankt
pc-schaap
iemand enig idee?
alvast bedankt