例如: #1234ff 输出 #1234ff
#123 输出 #123
#12345g 输出 #12345g
function RGB(rgb)
{
reg=/^#([a-fA-F0-9]{2})([a-fA-F0-9]{2})([a-fA-F0-9]{2})$/;
if ( reg.test(rgb) )
rgb='rgb('+parseInt(RegExp.$1,16)+","+parseInt(RegExp.$2,16)+","+parseInt(RegExp.$3,16)+')';
return rgb;
}
演示代码:
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn