Is there a way to determine if execCommand('undo') is executable? [JavaScript]

自作多情 提交于 2019-12-31 02:34:11

问题


I am trying to determine if the execCommand('undo') can be executed.

I've tried this one:

if(document.execCommand('undo'))
{
    document.execCommand('redo');
    // some code
}

and it works... But it makes me some problems with the other part of the script.

Is there another way to see if 'undo' is executable ?

Thanks in advance!


回答1:


  • document.queryCommandSupported http://msdn.microsoft.com/en-us/library/ms536681(VS.85).aspx
  • document.queryCommandEnabled http://msdn.microsoft.com/en-us/library/ms536676(VS.85).aspx

(yes, Midas is based on IE interfaces)



来源:https://stackoverflow.com/questions/5062526/is-there-a-way-to-determine-if-execcommandundo-is-executable-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!