我正在尝试编写一个函数,允许一个contenteditable div在用户输入div时进行一些自动格式化.到目前为止,我只能让它在IE中运行.有人可以帮帮我吗?
function formatOnKeyUp(){
if (window.getSelection) {
// ???????
} else if (document.selection) {
cursorPos=document.selection.createRange().duplicate();
clickx = cursorPos.getBoundingClientRect().left;
clicky = cursorPos.getBoundingClientRect().top;
}
text = document.getElementById('div1').innerHTML;
text = text.replace(/this/gm,"@H_404_8@
最佳答案