Forum : Can any1 help me with the query below?
Brief description  about Online courses   join in Online courses
View Sweety  Agarwal 's Profile

Can any1 help me with the query below?

Create a webpage that takes either one of the following as input, red, green or yellow. When user selects one of these and hits submit button, Change the color of webpage accordingly.

With regards,
sweety
Asked by Sweety Agarwal | Dec 20, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
<html>
<script language="javascript">
//function to set colour choices
function changebgcolour(){

if(document.form9.choosecolour[0].selected==true)
{
document.bgColor="white"
}
if(document.form9.choosecolour[1].selected==true)
{
document.bgColor="red"
}
if(document.form9.choosecolour[2].selected==true)
{
document.bgColor="blue"
}
if(document.form9.choosecolour[3].selected==true)
{
document.bgColor="green"
}
}


</script>
<form name="form9">

<SELECT name=choosecolour onChange="changebgcolour()">
<OPTION value=0 selected>none</OPTION>
<OPTION value=1>Red</OPTION>
<OPTION value=2>Blue</OPTION>
<OPTION value=3>Green</OPTION>
</SELECT>
</form>
</html>
Dec 23, 2010