你的编辑器的文字加粗是怎么做的,可以用DOM API,也可以预定义一系列css,当然后者有些笨但容易扩展,总之不管怎样逆向就可以了。编辑器的方法一般而言是用JAVAscript实现的  
  比如:加粗文字,选文字,点击加粗,编辑器会自动将文字转成'<b>...</b>'  
  你要插入图片时,你只要输入路径,编辑就会自动加入  
  <img   src="路径">   原理大概就这样的 那么如果再次选择,可以考虑用DOM API找到他们另外网上已经有的编辑器很多,可以复用,也可以参考一下  

解决方案 »

  1.   

    您好.我的编辑器  就是用 execCommand() 这个东东 来添加 效果 这东西很方便  唯一的缺点是  各个浏览器  执行这个方法后生成的代码不同.
    不过我注意了下. 我接触过的 所有 编辑器 都是使用这个接口 来实现的.现在的问题就是 如何 再次选择的时候 通过这个接口 获取到  当前的selection对象 被执行过哪些 execCommand()...  
      

  2.   

    IHTMLDocument2::selection   Property  
       
      --------------------------------------------------------------------------------  
       
      Retrieves   an   interface   pointer   to   an   object   representing   the   active   selection.   The   active   selection   can   be   an   insertion   point,   or   a   highlighted   block   of   text   or   other   elements   in   the   document   upon   which   the   user   or   a   script   can   carry   out   an   action.
      

  3.   

    谢谢你. 能不能说的详细点?
    是指 selection.property 这个可以获取到我要想要的东西么? 我测试了. undefined ...