我在文本區域中有一些值,當用戶編輯文本或添加一些新文本時....這些文本應該是不同的顏色..我不知道如何來實現這個..文本區域 - 當用戶編輯文本區域中的內容時,文本顏色變化
<textarea rows="50" cols="175" name="textname">
This is a text area to show some related details regarding the project
</textarea>
當我使用這個Javascript來改變用戶editied或輸入的文字轉換爲大寫..
function convert()
{
var str ;
str = document.getElementById("textname").value;
document.writeln(str.toUpperCase());
}
該功能可將所有的文字爲大寫任何人都可以幫助我...
你不能用'textarea'來做到這一點,使用'div'與'contenteditable'屬性 –
是否可以處理 JavaLearner1
您只能在「輸入」中爲整個文本提供顏色 –