日期:2014-05-16  浏览次数:20452 次

如何在脚本中改变lable 中字体的颜色
就是把原来的字体颜色进行动态的改变,要用js

------解决方案--------------------
<body>
<LABEL id= "labText "> abc </LABEL>
<input type= "text " id= "txtColor " value= "red " />
<input type= "button " id= "btnColor " value= "change color " />
<script type= "text/javascript ">
<!--
document.all.btnColor.onclick = function ()
{
document.all.labText.style.color = document.all.txtColor.value;
};
//-->
</script>
</body>
------解决方案--------------------
<body>
<LABEL id= "labText "> abc </LABEL>
<input type= "text " id= "txtColor " value= "red " />
<input type= "button " id= "btnColor " value= "change color " />
<script type= "text/javascript ">
<!--
document.all.btnColor.onclick = function ()
{
document.all.labText.style.color = document.all.txtColor.value;
};
//-->
</script>
</body>


这个就应该可以了