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?
| |
|
Welcome to KnowledgeSutra - Dear Guest | |
Custom Background Colors?
Started by scruppy, Sep 03 2010 12:08 AM
1 reply to this topic
#2
Posted 03 September 2010 - 01:21 AM
you can use this code to change the color of your background as you wish, just pick the desired color and press enter
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.
<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">
<!--
http://www.sadaagroup.com
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.
Reply to this topic

1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users














