0
我需要更改textarea中选定文本的文本颜色,当我单击按钮时。更改选定文本的颜色Javascript
我第一次尝试:
document.getSelectedText(document.getElementById('test22')).style.color = '#0F0';
我谢胜利尝试:
document.getSelectedText((test22.value).substring(test22.selectionStart, test22.selectionEnd)).style.color = '#0F0';
HTML代码:
<textarea name="area1" cols="40" id="test22"></textarea>
<button onclick="test();">CLICK</button>
谢谢! ;)
Problably这个副本:http://stackoverflow.com/questions/17288964/how-to-change-color-of-the-selected-文本动态地按一下按钮 – Mijago
是的,但我需要这个texarea。这只适用于“正常”文本。 – Tuxio
对不起:)我会再看看来帮助你:) – Mijago