Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Custom Background Colors?


1 reply to this topic

#1 scruppy

    Newbie [Level 1]

  • Kontributors
  • Pip
  • 12 posts

Posted 03 September 2010 - 12:08 AM

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?

#2 web_designer

    "french rose sparkle under moonlight"...do you believe in the magic of moonlight??!!...

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,385 posts
  • Gender:Female
  • Location:US, CA
  • Interests:internet and the web
    reading books
    sport
    watching tv series
    drawings and art
  • myCENT:73.47
  • Spam Patrol

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

<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


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users