即時製作一個好看的登錄系統,所以我想在表單中輸入內容時改變文本的顏色,但即時通訊無法弄清楚如何,我給他們分配了一個類來做這項工作,但它似乎沒有工作。用if語句指定類HTML
HTML: -
<div class="Login">
<form name="form1" method="get" action="index.php">
<input type="text" value="Username" name="Username" onblur="if (this.value === '') {this.value = 'Username'; this.class='Offline';}" onfocus="if (this.value === 'Username') {this.value = ''; this.class='Online';}">
<input type="text" value="Password" name="Password" onblur="if (this.value === '') {this.value = 'Password';}" onfocus="if (this.value === 'Password') {this.value = '';}">
<input type= "Submit" Name= "Submit" value= "Login" class="Button">
</form>
</div>
和IM改變對這些類在CSS的顏色。但所行似乎工作,任何人都可以指導我在這裏,我沒有很多的JavaScript腳本的經驗,所以我不想去那邊
它似乎正在工作,當我改變背景,我該如何改變字體顏色 –
@SahilSingh只使用'color:...'而不是'background-color' –
顏色不會像那樣改變一些原因,即時通訊能夠做的一切與字體,但改變顏色 –