HTML里的字体设定是在它外层的容器里设定的,它本身是没有style的

解决方案 »

  1.   

    在客户端浏览器中执行javascript是获取不到选中字体的大小、颜色等属性
      

  2.   

    function aaa()
    {
    //alert(document.getElementById("body1").createTextRange().htmlText);
    var mytext=document.body.createTextRange();
    if (mytext.findText("aa"))
    {
    mytext.select();
    alert(document.execCommand("FontSize",true,100);
    document.execCommand('ForeColor',false,'#BBDDCC');//true或false都可以
    }
    }
    设置到是可以,但是或许测试没成功