大佬教程收集整理的这篇文章主要介绍了jquery – iframe如何? contentWindow.文件. execCommand工作?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
first this is the link for the demo
我无法理解的是当你点击触发这个的粗体按钮时
$('.bold',tb).click(function(){ formatText(iframe,'bold');return false; });
然后它会被发送到formatText函数,这就是我迷失的地方,因为没有提到添加< strong>< / strong>标签到textarea的文本,我真的好奇知道它是如何工作的,谢谢.
function formatText(iframe,command,option) { iframe.contentWindow.focus(); try{ iframe.contentWindow.document.execCommand(command,false,option); }catch(E){Console.log(E)} iframe.contentWindow.focus();
formatText不是默认的jQuery函数.我从编辑器的js源代码中获取了上述内容.它首先关注的是文本所在的iframe区域.你不是真的在textarea字段中输入,而是在iframe contentEditable div< div contentEditable =“true”>< / div>中输入因为textarea不支持富文本编辑.然后该函数发出contentEditable exexCommand以使所选文本变为粗体.
您可以在http://help.dottoro.com/larpvnhw.php查看所有execCommands的列表
以上是大佬教程为你收集整理的jquery – iframe如何? contentWindow.文件. execCommand工作?全部内容,希望文章能够帮你解决jquery – iframe如何? contentWindow.文件. execCommand工作?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。