style.color怎么使用rgb

style.color如何使用rgb颜色?
style.color如何使用rgb颜色?问题里的html代码好像被吞了?

1、效果如下

img


img

2、代码如下

<div id="testDiv" style="margin:50px 0;width:200px;height:50px;line-height:50px;border:1px solid #ccc;text-align:center;">CSDN_开发者</div>
<script type="text/javascript">
    var div = document.getElementById('testDiv');
    div.onclick = function () {
        this.style.color = "rgb(95,174,227)";
        this.style.color = "#5faee3";
        this.style.fontWeight = "bold";
    }
</script>

可以把代码放出来看看的

color:rgb(0,0,0)

style.color="#00ff00"