Hello, I have the code in the annexe wich is working but grossly redondant, clearly, I would like to have only one function toggleEditor(), that would manage the global variables editInstance with a parameter or something equivalent to avoid having 2 twin like functions. Thanks for your suggestions.
HJS
Annexe :
Code:
<html>
<body>
<script src="../flovinax.js" type="text/javascript"></script>
<script>
var editInstance= null;
function toggleEditor1(edtN) {
if(editInstance===null) {
editInstance = new flovinaxa({fullPanel : true}).panelInstance(edtN);
} else {
editInstance.removeInstance(edtN);
editInstance= null;
}
}
var editInstance2= null;
function toggleEditor2(edtN) {
if(editInstance2===null) {
editInstance2 = new flovinaxa({fullPanel : true}).panelInstance(edtN);
} else {
editInstance2.removeInstance(edtN);
editInstance2= null;
}
}
</script>
<div>
<textarea style="width: 800px; height: 200px;" id="myArea"></textarea>
<br />
<button onClick="toggleEditor1('myArea');">+</button>
</div>
<div style="clear: both;"></div>
<div>
<textarea style="width: 800px; height: 200px;" id="myArea2"></textarea>
<br />
<button onClick="toggleEditor2('myArea2');">+</button>
</div>
<div style="clear: both;"></div>
</body>
</html>