<div style="cursor:hand" onclick="window.open()">文本</div>

解决方案 »

  1.   


    var oTextRange=document.selection.createRange();
    var strHTML="<a style='color=white;background-color:#316AC5;'>"+oTempRange.htmlText+"</a>";
    oTextRange.text="";
    oTextRange.pasteHTML(strHTML);用这个方法,可以把选择的文本替换成任何东西...呵呵..
    注意,TextRange 有两个属性,一个是 htmlText 是只读的,text 是可读可写的
      

  2.   

    sorry:上面第二行应该改成下面的:var strHTML="<a style='color=white;background-color:#316AC5;'>"+oTextRange.htmlText+"</a>";