Saturday, November 20, 2010

How to change my website background color?

I have already posted this question here. But u folks got it wrong. Im putting in right way.





I like the color changing option given in the site http://tamilnadu.com/tamilnadu/main/common/index.jsp


I like to have one in my site. I did not mean the gradient thing in that site. what i ment is bg color changing option.How to change my website background color?
Ok, I see it, it's the select control on top of the page, with orange, red, green, blue options.





Basically, here's how to do it :





1. If you just want to change the color :


code:


================


%26lt;html%26gt;


%26lt;head%26gt;


%26lt;script language=';JavaScript'; type=';text/javascript';%26gt;





function changeBG()


{


var str = document.getElementById('colSelector').o鈥?br>

var urlStr = 'url(' + str + ')';


document.getElementById('mainDiv').style鈥?= str;


}


%26lt;/script%26gt;








%26lt;/head%26gt;


%26lt;body%26gt;


%26lt;div id=';mainDiv';%26gt;


%26lt;form id=';mainForm'; name=';mainForm';%26gt;


%26lt;select id=';colSelector'; name=';colSelector'; onChange=';changeBG();';%26gt;


%26lt;option value=';red';%26gt;Red%26lt;/option%26gt;


%26lt;option value =';blue';%26gt;Blue%26lt;/option%26gt;


%26lt;option value=';yellow';%26gt;Yellow%26lt;/option%26gt;


%26lt;/select%26gt;


%26lt;/form%26gt;


%26lt;/div%26gt;


%26lt;/body%26gt;


%26lt;/html%26gt;


=============





2.


A. However, if you want to change the background image :


e.g. You have 3 images, 1.jpg, 2.jpg,3.jpg, put them in the same folder as your html page.





B. Your html page should look like this :


============


%26lt;html%26gt;


%26lt;head%26gt;


%26lt;script language=';JavaScript'; type=';text/javascript';%26gt;





function changeBG()


{





var str = document.getElementById('colSelector').o鈥?br>

var urlStr = 'url(' + str + ')';


document.body.style.backgroundImage = urlStr;


}


%26lt;/script%26gt;








%26lt;/head%26gt;


%26lt;body%26gt;


%26lt;form id=';mainForm'; name=';mainForm';%26gt;


%26lt;select id=';colSelector'; name=';colSelector'; onChange=';changeBG();';%26gt;


%26lt;option value=';1.jpg';%26gt;Red%26lt;/option%26gt;


%26lt;option value =';2.jpg';%26gt;Blue%26lt;/option%26gt;


%26lt;option value=';3.jpg';%26gt;Yellow%26lt;/option%26gt;


%26lt;/select%26gt;


%26lt;/form%26gt;


%26lt;/body%26gt;


%26lt;/html%26gt;


=============





Hope this helps! =)How to change my website background color?
use %26lt;body bgcolor=';color name';%26gt; or u cane also make use of hexadecimal RGB codes like %26lt;body bgcolor=#ff0000%26gt;
%26lt;body bgcolor=';#000000';%26gt;


%26lt;body bgcolor=';rgb(0,0,0)';%26gt;


%26lt;body bgcolor=';black';%26gt;





The lines above all set the background-color to black
%26lt;bgcolor= '; Which Color u want type here';%26gt;
%26lt;bgcolor=';color u want';%26gt;





dis tag will help u changing da color
%26lt;bgcolor=';color u want';%26gt;


%26lt;bgcolor=';HEX color code';%26gt;





Those tags are to be placed in your HTML file.
You can use either ';bgcolor'; property of body tag from html source or user background-color property of body from css.





%26lt;body bgcolor=';#0000CC';%26gt;%26lt;/body%26gt;





OR from external css





body {


background: white;/*change this color*/


//or


//background-color:#33FF99


}
  • borrow money
  • Can humans catch giardia from dogs
  • No comments:

    Post a Comment