I have a question and an issue wrt the code below:
My question is what is the scope of the variable loaded
here. The reason why i ask this is the onload="if(loaded==1)inittextarea()
code is working fine on Firefox and not IE8. Why is this happening? Is there something specific i need to do here? Or is it not a valid practice?
<html>
<head>
<title>Some Page</title>
<link rel="stylesheet" href="../css/default.css" type="text/css">
<script type="text/javascript">
var loaded = 0; /*Point of interest*/
function jsLoaded() {
loaded =1;
}
</script>
<script type="text/javascript">
function inittextarea() {
alert("test")
tinyMCE.init({
elements : "content",
theme : "advanced",
readonly : true,
mode : "exact",
theme : "advanced",
readonly : true,
setup : function(ed) {
ed.onInit.add(function() {
tinyMCE.activeEditor.execCommand("mceToggleVisualAid");
});
}
});
}
</script>
<script src="../js/tiny_mce/tiny_mce.js" onload="jsLoaded()" type="text/javascript"></script>
</head>
<body onload="if(loaded==1)inittextarea()"><!--Works on Firefox only-->
*Usual stuff*
</body></html>
Any pointers please?