Jump to content
xisto Community
Sign in to follow this  
scruppy

Custom Background Colors?

Recommended Posts

so for a class at school Im learning java and our assignment is to make a window with a pale green background and all i can make is a green one whats the code to change a color or make a new one?

Share this post


Link to post
Share on other sites

you can use this code to change the color of your background as you wish, just pick the desired color and press enter


<FORM name="back"><SELECT name="g" onChange="change()">
<OPTION VALUE="aqua"> aqua <OPTION VALUE="green">green
<OPTION VALUE="orange">orange <OPTION VALUE="yellow">yellow
<OPTION VALUE="purple">purple <OPTION VALUE="gray">gray
<OPTION VALUE="pink">pink <OPTION VALUE="lavender">lavender
<OPTION VALUE="khaki">khaki <OPTION VALUE="skyblue">skyblue
<OPTION VALUE="white" SELECTED>white</SELECT>
<INPUT TYPE="button" VALUE="choose color"></FORM>
<script language="Javascript">
<!--
function change() {document.bgColor = document.back.g.options[document.back.g.selectedIndex].value}//--></script>

put this code between body tag, and notice that you can change the color of the background from the value attribute to whatever you want by using hexadecimal like adding the black color like this (#000000). and by the way i tested the code and it worked fine,good luck.


Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.