Click to See Complete Forum and Search --> : Help with this code


Greelmo
05-14-2003, 09:25 PM
okay, i want radio buttons that will change the background color when selected... i have the general idea of how it should go and i can't find why my code isn't working, so here it is... i REALLY need help with this:

<html>
<head>
<title>Happy Birthday Grandma!!!</title>
<SCRIPT LANGUAGE = "JavaScript">
function fncback(main1, other1, other2, other3, other4, other5, other6, other7, other8, other9, other10)
{
var colory=window.document.form1.main1;
var no1=window.document.form1.other1;
var no2=window.document.form1.other2;
var no3=window.document.form1.other3;
var no4=window.document.form1.other4;
var no5=window.document.form1.other5;
var no6=window.document.form1.other6;
var no7=window.document.form1.other7;
var no8=window.document.form1.other8;
var no9=window.document.form1.other9;
var no10=window.document.form1.other10;
if(colory.checked == true){
no1.checked=false;
no2.checked=false;
no3.checked=false;
no4.checked=false;
no5.checked=false;
no6.checked=false;
no7.checked=false;
no8.checked=false;
no9.checked=false;
no10.checked=false;
document.bgColor=colory.value;}
}
</script>
</head>
<body>
<table border=0 cellpadding=0 cellspacing=0><tr>
<td align=left>
<form name="form1">
<font size=3><b>Background color:</b></font><br>
<input type="radio" name="text1" value="White" checked onClick="fncback(text1, text2, text3, text4, text5, text6, text7);">White<br>

<input type="radio" name="text2" value="Black" onClick="fncback(text2, text1, text3, text4, text5, text6, text7);">Black<br>

<input type="radio" name="text3" value="Orange" onClick="fncback(text3, text2, text1, text4, text5, text6, text7);">Orange<br>

<input type="radio" name="text4" value="Green" onClick="fncback(text4, text2, text3, text1, text5, text6, text7, text8, text9, text10, text11);">Green<br>

<input type="radio" name="text5" value="Yellow" onClick="fncback(text5, text2, text3, text4, text1, text6, text7, text8, text9, text10, text11);">Yellow<br>

<input type="radio" name="text6" value="Purple" onClick="fncback(text6, text2, text3, text4, text5, text1, text7, text8, text9, text10, text11);">Purple<br>

<input type="radio" name="text7" value="Aqua" onClick="fncback(text7, text2, text3, text4, text5, text6, text1, text8, text9, text10, text11);">Aqua<br>

<input type="radio" name="text8" value="Teal" onClick="fncback(text8, text2, text3, text4, text5, text6, text7, text1, text9, text10, text11);">Teal<br>

<input type="radio" name="text9" value="Blue" onClick="fncback(text9, text2, text3, text4, text5, text6, text7, text8, text1, text10, text11);">Blue<br>

<input type="radio" name="text10" value="Gray" onClick="fncback(text10, text2, text3, text4, text5, text6, text7, text8, text9, text1, text11);">Grey<br>

<input type="radio" name="text11" value="Pink" onClick="fncback(text11, text2, text3, text4, text5, text6, text7, text8, text9, text10, text1);">Pink<br>
<font size=3><b>Font color:</b></font>
<input type="text" name="text2">
</td></tr></table>
</form>
</body>
</html>

Just tell me the part where i went wrong and how i can fix it