Use JavaScript script to make your own color spectrum

Source: Internet
Author: User
Tags array dreamweaver
javascript| Script

The color of the website is the important problem that the website construction must consider seriously. The use of the site's color can often reflect the characteristics of a website and artistic style. Therefore, when designing a Web page, you often need to set the color of the page background or other page elements, and the web design software (such as Dreamweaver) has a palette of more than 200 color samples to choose from. If you're designing a Web page with a bit of color, you can use JavaScript script to make your own color spectrum, which will make your design work much easier.


The color of the website is the important problem that the website construction must consider seriously. The use of the site's color can often reflect the characteristics of a website and artistic style. Therefore, when designing a Web page, you often need to set the color of the page background or other page elements, and the web design software (such as Dreamweaver) has a palette of more than 200 color samples to choose from. If you're designing a Web page with a bit of color, you can use JavaScript script to make your own color spectrum, which will make your design work much easier.

The HTML code and JavaScript script that displays the Chromatogram are as follows:

<HTML>
<HEAD>
<TITLE> Chromatogram Chart </TITLE>
<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">
</HEAD>
<body bgcolor= "#FFFFFF" >
<CENTER>
<script language= "JavaScript" >
Defining an Array Object
Clr=new Array (', ', ', ', ', ', ', ' A0 ', ' C0 ', ' FF ');
Create a table with 8 8 rows and 8 columns
for (i=0;i<8;i++) {
Create a table with cells filled in 8 pixels
document.write ("<table border=1 cellpadding=8>");
for (j=0;j<8;j++) {
document.write ("<tr>");
for (k=0;k<8;k++) {
Set the background color of a table cell
document.write (' <td bgcolor= "# ' +clr[i]+clr[j]+clr[k]+ '" > ');
Set Text color
document.write (' <tt><font color= "# ' +clr[7-i]+clr[7-j]+clr[7-k]+ '" > ');
Display 16 in color values
document.write (' # ' +clr[i]+clr[j]+clr[k]+ ' </font></tt></td> '); }
document.write ("</tr>"); }
document.write ("</table><br>"); }
</SCRIPT>
</CENTER>
</BODY>
</HTML>

Click here to see 512 color chromatogram. The chromatogram consists of 8 tables, each of which has 64 colors. When applied, copy the 16 color value of the color you selected in the Chromatogram, and paste it into the color code box.




Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.