The code below correctly sets an iframe to be editable, and then tries
to attach an "onkeyup" event to the iframe. Instead of doing that,
however, it generates a cryptic "Object required" error in Explorer 7,
and doesn't seem to do anything at all in Firefox. Am I missing
something really basic?
Thanks for any help.
--Brent
--------------------------------------------------------------------------
function makeEditable(el )
{
thisEl = el.contentWindo w.document;
try
{
if(thisEl.body. contentEditable )
{thisEl.body.co ntentEditable = true;}
else
{thisEl.designM ode = "on";}
}
catch(e)
{
alert(e);
}
thisEl.body.sty le.fontFamily = "verdana, arial, helvetica, sans-
serif";
thisEl.body.sty le.fontSize = "12px";
thisEl.body.sty le.margin = "1px";
thisEl.onkeyup = checkKeys; //<--doesn't seem to register the
event
}
function checkKeys(e)
{
var event = e ? e : window.event;
var KeyID = event.keyCode;
alert(KeyID);
}
to attach an "onkeyup" event to the iframe. Instead of doing that,
however, it generates a cryptic "Object required" error in Explorer 7,
and doesn't seem to do anything at all in Firefox. Am I missing
something really basic?
Thanks for any help.
--Brent
--------------------------------------------------------------------------
function makeEditable(el )
{
thisEl = el.contentWindo w.document;
try
{
if(thisEl.body. contentEditable )
{thisEl.body.co ntentEditable = true;}
else
{thisEl.designM ode = "on";}
}
catch(e)
{
alert(e);
}
thisEl.body.sty le.fontFamily = "verdana, arial, helvetica, sans-
serif";
thisEl.body.sty le.fontSize = "12px";
thisEl.body.sty le.margin = "1px";
thisEl.onkeyup = checkKeys; //<--doesn't seem to register the
event
}
function checkKeys(e)
{
var event = e ? e : window.event;
var KeyID = event.keyCode;
alert(KeyID);
}
Comment