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