本文地址:http://blog.csdn.net/stalendp/article/details/8102326
在开发android应用的时候,经常接触到颜色,由于eclipse中没有颜色识别的插件,所以写了一个html的简单的颜色识别器。
效果如下:
代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Color Detector</title>
<script type="text/javascript">
function calc() {
var color = document.getElementById("color").value;
if(color.length!=7 && color.length!=9) {
alert(color.length + "The format of color is