<span id="ospan">扁担长,板凳宽,板凳没有扁担长,扁担没有板凳宽。扁担<font color='blue'>要绑</font><font color='blue'>在板</font>凳上,板凳偏不让扁担绑在板凳上。
</span>
<INPUT TYPE="button" value="change" onclick="Test()"><script>
function Test()
{
//var str=document.selection.createRange().text;
//ospan.innerHTML = ospan.innerHTML.replace(str,"<font color='red'>"+str+"</font>");
var str = document.selection.createRange();
str.execCommand('ForeColor',false,'red');
} </script>这种应该用execCommand
</span>
<INPUT TYPE="button" value="change" onclick="Test()"><script>
function Test()
{
//var str=document.selection.createRange().text;
//ospan.innerHTML = ospan.innerHTML.replace(str,"<font color='red'>"+str+"</font>");
var str = document.selection.createRange();
str.execCommand('ForeColor',false,'red');
} </script>这种应该用execCommand
我开始用用了execCommand的,我还以为execCommand只能用在<iframe>里面,原来可以用在页面上啊?
高兴ing.......
我开始用用了execCommand的,我还以为execCommand只能用在<iframe>里面,原来可以用在页面上啊?
高兴ing.......