Here's a sample page with no linked script. Just load this in Internet Explorer (I'm using version 7.0) and hit the refresh after each load. The problem occurs sporadically, but does happen. It's more apparent if you add an alert to the CuteEditor_OnInitialized stub as well so that you can see it fire instead:
<%@ Page Language="C#"%>
<%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
<html>
<head>
<title>ASP and ASP.NET WYSIWYG Editor - Default Configuration </title>
<link rel="stylesheet" href="../example.css" type="text/css" />
<script type="text/javascript" language='javascript'>
function AddEventSimple(obj,evt,fn) {
if (obj.addEventListener)
obj.addEventListener(evt,fn,false);
else if (obj.attachEvent)
obj.attachEvent('on'+evt,fn);
}
function RemoveEventSimple(obj,evt,fn) {
if (obj.removeEventListener)
obj.removeEventListener(evt,fn,false);
else if (obj.detachEvent)
obj.detachEvent('on'+evt,fn);
}
function showSomething()
{
var theEditor = document.getElementById('<%=StemEditor.ClientID%>');
var theDocument = theEditor.GetDocument();
alert(theDocument.body.innerHTML);
}
function addToolbarEvents(imageObject, clickFunction)
{
AddEventSimple(imageObject, 'mouseup', tbarup);
AddEventSimple(imageObject, 'mousedown', tbardown);
AddEventSimple(imageObject, 'click', function() { clickFunction(document.getElementById('<%=OptionEditor.ClientID%>'), document.getElementById('<%=AnswerKey.ClientID%>')); return false; });
}
function setupImages()
{
}
function tbarup(e)
{
tbarhilite(e, 'v');
}
function tbardown(e)
{
tbarhilite(e, 'd');
}
//toolbar presentation function
function tbarhilite(e, ev)
{
var e = (e) ? e : window.event;
var el = (e.target) ? e.target : e.srcElement;
if( typeof(el.tagName) != "undefined" && el.tagName=="IMG" )
{
if (el.disabled != true)
{
if (el.className != "tbarBtnSelected")
{
switch(ev){
case "o":
el.className="tbarBtn";
break;
case "u":
el.className="tbarBtnOutset";
break;
case "v":
el.className="tbarBtnOutset";
break;
case "d":
el.className="tbarBtnInset";
break;
}
}
}
}
}
</script>
<!--<script type="text/javascript" language='javascript' src='ItemEditor.js'></script>-->
</head>
<body onload="setupImages();">
<form runat="server">
<table cellspacing=0 cellpadding=0 border=0 style="width:100%; height:100%;">
<tr style="width:100%">
<td valign=top colspan=3>Stem:</td>
</tr>
<tr style="height:40%; width:100%">
<td valign=top colspan=3>
<CE:Editor id="StemEditor" EditorWysiwygModeCss="../example.css" runat="server" ShowHtmlMode="False" ShowPreviewMode="False" TemplateItemList="Bold, Italic, Underline, StrikeThrough|ForeColor, BackColor|Justify, JustifyLeft, JustifyCenter, JustifyRight, JustifyFull, JustifyNone|Superscript, Subscript, RemoveFormat|Find|Cut, Copy, Paste, Undo, Redo|Indent, Outdent|OrderedList, UnorderedList" Width="100%" ShowBottomBar="False" ></CE:Editor>
</td>
</tr>
<tr style="width:100%">
<td valign=top colspan=3>Options:</td>
</tr>
<tr style="height:40%; width:100%">
<td valign=top colspan=2>
<CE:Editor id="OptionEditor" EditorWysiwygModeCss="../example.css" runat="server" ShowHtmlMode="False" ShowPreviewMode="False" TemplateItemList="Bold, Italic, Underline, StrikeThrough, ForeColor, BackColor, Justify, JustifyLeft, JustifyCenter, JustifyRight, JustifyFull, JustifyNone, Superscript, Subscript, RemoveFormat" Width="100%" ShowBottomBar="False"></CE:Editor>
</td>
<td valign=top width=1%>
<asp:Image ID="ToolbarUp" CssClass="tbarBtnOutset" BorderStyle="NotSet" BorderWidth="1" AlternateText="Up" runat=server /><br />
<asp:Image ID="ToolbarDown" CssClass="tbarBtnOutset" BorderStyle="NotSet" BorderWidth="1" AlternateText="Down" runat=server /><br />
<asp:Image ID="ToolbarScramble" CssClass="tbarBtnOutset" BorderStyle="NotSet" BorderWidth="1" AlternateText="Scrambe" runat=server /><br />
<asp:Image ID="ToolbarLengthList" CssClass="tbarBtnOutset" BorderStyle="NotSet" BorderWidth="1" AlternateText="Sort by Length" runat=server /><br />
<asp:Image ID="ToolbarSort" CssClass="tbarBtnOutset" BorderStyle="NotSet" BorderWidth="1" AlternateText="Sort By Value" runat=server />
</td>
</tr>
<tr style="width:100%">
<td valign=top colspan=3>Key:</td>
</tr>
<tr style="width:100%">
<td style="width:50%;" valign=top>
<asp:TextBox ID="AnswerKey" Runat="server" />
</td>
<td align=right valign=top>
<asp:Button id="btnUpdate" onclick="Submit" Runat="server" Text="Show HTML"></asp:Button>
</td>
<td></td>
</tr>
<tr style="width:100%">
<td colspan=3>
<asp:Literal ID="Literal1" Runat="server" />
</td>
</tr>
</table>
<input type='button' onclick='showSomething();' value='ClickMe!'>
</form>
</body>
</html>
<script runat="server">
void Page_Load(object sender, System.EventArgs e)
{
if (IsPostBack)
{
Literal1.Text = "<h2>The HTML you typed is...</h2><br>";
Literal1.Text += Server.HtmlEncode(StemEditor.Text);
}
else
{
ToolbarUp.ImageUrl = "../images/toolbar/up.gif";
ToolbarDown.ImageUrl = "../images/toolbar/down.gif";
ToolbarScramble.ImageUrl = "../images/toolbar/scramble.gif";
ToolbarLengthList.ImageUrl = "../images/toolbar/lengthlist.gif";
ToolbarSort.ImageUrl = "../images/toolbar/sort.gif";
StemEditor.Text = ""; //"<OL ID='Options' style='list-style-type:upper-alpha'><LI keyed='' translated='false' partid='0' isoption='true'></LI></OL>";
}
}
public void Submit(object sender, System.EventArgs e)
{
Literal1.Text = "<h2>The HTML you typed is...</h2><br>";
Literal1.Text += Server.HtmlEncode(StemEditor.Text);
}
</script>
<script language='JavaScript'>
var stemEditor = document.getElementById('<%=StemEditor.ClientID%>');
var optionEditor = document.getElementById('<%=OptionEditor.ClientID%>');
var keyElement = document.getElementById('<%=AnswerKey.ClientID%>');
function CuteEditor_OnInitialized(editor) {
alert("Event Fired!");
}
function CuteEditor_OnChange(editor)
{
}
</script>