write a java script to another background changer. it just take the selected value from the list and makes that the background color.

write a java script to another background changer. it just take the selected value from the list and makes that the background color.

<html>
 <head><title>Change Background using list</title>
 <style>
li{
font-size:30px;
font-family:candara;
cursor:pointer;
}
 </style>

 </head>
 <body>

 <ul type="circle">
<li onclick="def()">Click On list to Change Background Color</li>
<ol type="1">
<li onclick="red()">RED</li>
<li onclick="g()">GREEN</li>
<li onclick="y()">YELLOW</li>
<li onclick="b()">BLUE</li>
<li onclick="sb()">SKYBLUE</li>
<li onclick="o()">ORANGE</li>
<li onclick="s()">SILVER</li>
<script type="text/javascript">

function def(){
document.body.style.backgroundColor="white";
}

function red(){
document.body.style.backgroundColor="red";
}
function g(){
document.body.style.backgroundColor="green";
}

function y(){
document.body.style.backgroundColor="yellow";
}
function b(){
document.body.style.backgroundColor="blue";
}

function sb(){
document.body.style.backgroundColor="skyblue";
}

function o(){
document.body.style.backgroundColor="orange";
}

function s(){
document.body.style.backgroundColor="silver";
}
</script>

 </body>

</html>

OUTPUT:

Comments

Popular Posts