I need a really simple JS script, but I'm having a blonde day.

Basically, I need to have a load of checkboxes, and if they are clicked, they simply add the value of the checkbox to a text input form to create a comma separated list.

This is what I started with, until I realised there is a better way to do this - to ask a JS guru at SPF!

<script language="Javascript">

function addTo() {

swatches.list.value = swatches.id.value + ',';



<form name="swatches">
<input type="checkbox" id="1"  value="1" onClick="addTo()">1
<input type="checkbox" name="2" value="2">2
<input type="checkbox" name="3" value="3">3
<input type="checkbox" name="4" value="4">4
<input type="checkbox" name="5" value="5">5
<input type="checkbox" name="6" value="6">6

<input type="text" name="list">
It sorta works, but not as it should. Someone wanna sort me out?