PDA

View Full Version : mshtml undo command


homerUK
05-06-2003, 11:16 PM
hey,

does anyone have any experience with MSHTML commands?
I have been trying to get the "undo" command in a WYSIWYG editor to work using the following code:

function cmdExec(cmd,opt) {
iView.document.execCommand(cmd,"",opt);
}

then calling that function using an undo image for the button like:

onClick="cmdExec('undo')"

but it doesnt seem to work....

any ideas?!!! thanks......

arnyinc
05-07-2003, 01:46 PM
This works for me:

<html>
<body onload="frameEdit.document.designMode='on';">
<form id="frmEdit">
<iframe id="frameEdit" style="width:600px; height:300px" align="center"></iframe>
<br>
<center>
<input type="button" value="undo" onclick="frameEdit.document.execCommand('undo');">
</center>
</form>
</body>
</html>

If I change the onclick event to frameEdit.document.execCommand('undo', "", opt) it stops working, which is effectively what I think your function call does.

dswimboy
03-23-2004, 10:27 PM
last i checked, the "Undo" and many other functions aren't currently supported. check out http://msdn.microsoft.com/workshop/author/dhtml/reference/commandids.asp for a list of commands that can be used with .execCommand()

swmr
03-23-2004, 10:58 PM
More commands are supported than that reference implies...