Random Color for Web Page Background

The simplest way to set a random color as a background is to generate a random color hash and set it using Css

So here is the code for that .

<script type="text/javascript">// <![CDATA[
// ]]></script>
        function RandomColorHash()
            var list=[ '0',  '1',  '2',  '3',  '4',  '5',  '6', '7',  '8', '9',  'A',  'B',  'C',  'D',  'E',  'F' ],Color=’#';
            for(var i=0;i<6;i++)
            return Color;

The above code uses jQuery but this can also be done in JavaScript.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s