标签: javascript text range edit
如何创建自己的document.execCommand?因此,例如我想创建像文本中心(execCommand仅支持justifyCenter,justifyLeft,justifyRight)或者如果我想创建图像的对齐。
答案 0 :(得分:4)
您无法创建自己的document.execCommand,但可以使用Rangy修改文字选择。
document.execCommand
例如,如果您想要居中文字,请尝试以下方法: http://jsfiddle.net/DerekL/h9Ym2/
查看更多演示here。