I am an amateur in javascript but wanted to make a project that you click a checkbox automatically update a textbox.
I have found an example very similar to what i want and is the following:

<style type="text/css">
label {display:block; margin:1em 0em}
input {margin:0ex 1ex}

<form action="">
<label><input type="checkbox" name="vehicle" value="Bike" onClick="updateArea(this)">sos1</label>
<label><input type="checkbox" name="vehicle" value="car" onClick="updateArea(this)">sos2</label>
<label><input type="checkbox" name="vehicle" value="train" onClick="updateArea(this)">sos3</label>
<label><input type="checkbox" name="vehicle" value="Boat" onClick="updateArea(this)">sos4</label>
<label><input type="checkbox" name="vehicle" value="plain" onClick="updateArea(this)">sos5</label>


<script type="text/javascript">
document.write(' cols="100" id="area" rows="10"></textarea>')

function updateArea (e) {
document.getElementById('area').value = "sos";
for (var i=0; i<e.form.elements.length; i++)

{if (e.form.elements[i].type == 'checkbox' && e.form.elements[i].checked)

{document.getElementById('area').value += e.form.elements[i].nextSibling.data; document.getElementById('area').value += '\n';}};
// -->

My problem is that it updates the textbox with the value of the checkbox label and I wanted to updating it with the checkbox value.
I have noticed that it is the function "e.form.elements [i]. NextSibling.data" will fetch the value to write in the textbox, just can not put it to fetch the other value ....

Some precious help?

thank you