One gets the random color generation in the area

Source: Internet
Author: User
Random if you want to make a color list whether in a headache so many colors how to complete the column?

If you need to let the user choose color, but also afraid not to consider the color code what to do?

With RGB (255,255,255) or with #ffffff or with 0x666666 good?

Today, I also encountered this problem, by the way, I thought of a way, since I want to come out then everyone to share ~,

Code:
____________________________________
<select>
?
For ($int _a=0 $int _a<16; $int _a++) {//<option> number to display
For ($a =0 $a <6; $a + +) {//) using the #ffffff method,
$d. =dechex (rand (0,15))//cumulative random Data--dechex () change decimal to hexadecimal
}
Print "<option value=\" # $d \ "style=\" background-color:# $d \ "># $d </option>\n";//Printing Get color code
Unset ($d);//Remove color codes
}?>
</select>
Attach a
<input Type=button onclick= "Window.location.reload ()" value= "Refresh page to regain new color" >


OK, so your color is ever-changing, do not worry about the color column is not finished ~, hehe

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.