-1
從下拉選擇顏色下拉菜單更改文本字段的文本的顏色我想從如何通過HTML
<div class = "form-group" >
<label for = "" class = "" > Select Colour < /label>
<div class = "dropdown" >
<button class = "btn _select_color dropdown-toggle"
type = "button"
id = "dropdownMenu1"
data - toggle = "dropdown"
aria - haspopup = "true"
aria - expanded = "false" > Green < span class = "caret _right" > < /span> <span _text_display="Green" class="color green"></span > < /button>
<ul class = "dropdown-menu _select_color_drop"
aria - labelledby = "dropdownMenu1" >
<li > < span _text_display = "Green"
class = "color green" > < /span></li >
<li > < span _text_display = "Red"
class = "color red" > < /span></li >
<li > < span _text_display = "Yellow"
class = "color yellow" > < /span></li >
<li > < span _text_display = "Brown"
class = "color brown" > < /span></li >
<li > < span _text_display = "Orange"
class = "color orange" > < /span></li >
<li > < span _text_display = "Pink"
class = "color pink" > < /span></li >
<li > < span _text_display = "Silver"
class = "color silver" > < /span></li >
<li > < span _text_display = "Bule"
class = "color blue"
name = "blue"
value = "blue" > < /span></li >
<li > < span _text_display = "TEAL"
class = "color TEAL" > < /span></li >
<li > < span _text_display = "NAVY"
class = "color NAVY" > < /span></li >
<li > < span _text_display = "PURPLE"
class = "color PURPLE" > < /span></li >
<li > < span _text_display = "OLIVE"
class = "color OLIVE" > < /span></li >
<li > < span _text_display = "LIME"
class = "color LIME" > < /span></li >
<input type = "hidden"
name = "_color"
value = "Green" > < /ul>
</div>
</div>
選擇一個值和我想要的顏色會在
<form name="myForm" action="#">
<div class="form-group">
<label for="message"> Text Here</label>
<textarea name="txt1" id="message" cols="30" rows="9" class="form-control"></textarea>
<input type="text" value="something" onclick="this.value='';this.style.color=_color;" /> </div>
</form>
從顏色列表中選擇的顏色必須反映在文本文件中。我是HTML CSS和JS的新手。
格式化第一碼snipp等你發佈。這是很難讀 –
請閱讀[在什麼情況下,我可以添加「緊急」或其他類似的短語,以獲得更快的答案?](/ meta.stackoverflow.com/q/326569) - 摘要這不是解決志願者問題的理想方式,而且可能會對獲得答案產生反作用。請不要將這添加到您的問題。 – halfer