Inserting items from a form where the cursor is using javascript

I put together the script below from solutions I found online. In the script, clicking on a link, inserts text into a textarea. But is it possible to add items from a form to the textarea the same way? You’ll see with the example below. The form is below the horizontal line. So clicking on a link will add selected items from that form to the textarea, on a single line. Any idea how it can be done?


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<title>Extended functionaly for textelements</title>
	<script type="text/javascript">

function insertAtCaret(areaId,text) {
    var txtarea = document.getElementById(areaId);
    var scrollPos = txtarea.scrollTop;
    var strPos = 0;
    var br = ((txtarea.selectionStart || txtarea.selectionStart == '0') ? 
        "ff" : (document.selection ? "ie" : false ) );
    if (br == "ie") { 
        var range = document.selection.createRange();
        range.moveStart ('character', -txtarea.value.length);
        strPos = range.text.length;
    else if (br == "ff") strPos = txtarea.selectionStart;

    var front = (txtarea.value).substring(0,strPos);  
    var back = (txtarea.value).substring(strPos,txtarea.value.length); 
    strPos = strPos + text.length;
    if (br == "ie") { 
        var range = document.selection.createRange();
        range.moveStart ('character', -txtarea.value.length);
        range.moveStart ('character', strPos);
        range.moveEnd ('character', 0);;
    else if (br == "ff") {
        txtarea.selectionStart = strPos;
        txtarea.selectionEnd = strPos;
    txtarea.scrollTop = scrollPos;
<textarea id="textareaid" cols=50 rows =10></textarea>
<a href="#" onclick="insertAtCaret('textareaid','Java Beans ');return false;">Java Beans</a>
<a href="#" onclick="insertAtCaret('textareaid','Cocoa');return false;">Cocoa</a>
Land <INPUT TYPE="radio" name= "mode" value="land"> Sea <INPUT TYPE="radio" name="mode" value="sea"> Air <INPUT TYPE="radio" name="mode" value="air">
Java<INPUT TYPE="checkbox" name = "item" value="Java Beans"> Cocoa <INPUT TYPE="checkbox" name="item=" value="Cocoa">
<a href="#" onclick="insertAtCaret('textareaid','Cocoa');return false;">Add to Text Box</a>