RSS
热门关键字:  数据挖掘  数据仓库  商业智能  人工智能  搜索引擎

关于在FireFox下的style.backgroundColor 值,急!

来源: 作者: 时间:2008-01-01 点击:

本文由网龙AE产品自动生成 数据挖掘研究院

在FireFox下
...
curRow.style.backgroundColor='#ff0000';
alert(curRow.style.backgroundColor);
....

结果是RGB颜色值,为什么?如何让它保持原颜色16位(#ff0000)格式?

一般编程语言都有数据类型转换函数,试试看呢?Javascript偶不熟,偶只输HTML,嘿嘿。

参考以下的。

HTML code
<script type="text/javascript"> function MyColor(name,r,g,b){ this.name=name; this.red=r; this.green=g; this.blue=b; } MyColor.prototype.hexValue=function(){ var hR=this.red.toString(16); var hG=this.green.toString(16); var hB=this.blue.toString(16); return "#"+(this.red<16?("0"+hR):hR)+(this.green<16?("0"+hG):hG)+(this.blue<16?("0"+hB):hB); }; var CnLeiColor=new MyColor("red",255,0,0); alert(CnLeiColor.hexValue()); </script>
数据挖掘研究院
最新评论共有 0 位网友发表了评论
发表评论
评论内容:不能超过250字,需审核,请自觉遵守互联网相关政策法规。
匿名?