I have a textarea field (TArea) that uses custom fonts. I can change the font from a list. For testing purposes, I have a form field that returns the style attributes of the textarea field when I do an onClick. If I enter font-family in the test field, it returns an alert of: font-family = [font name]

I want to remove the test field, and move that function to the changeFont code. How do I modify my changeFont code to return the style attributes of the textarea field, and store the font name in a hidden field? The goal is to store the font with the record, and hopefully, when I query the record, load the record with the font it was saved with.

Here's the javascript for changing the font:
Code:
<!--- changeFont code --->
<script>
// function changeFont(selfont)
function changeFont(selfont)
{
elm=document.getElementById("TArea")
elm.style.fontFamily=selfont
}
</script>

<div onclick="changeFont()" />  
<a href="javascript:changeFont('Font1')">Font1</a>
<a href="javascript:changeFont('Font2')">Font2</a>
<a href="javascript:changeFont('Font3')">Font3</a>
<a href="javascript:changeFont('Font4')">Font4</a>
<a href="javascript:changeFont('Font5')">Font5</a>
<a href="javascript:changeFont('Font6')">Font6</a>
</div>

Here's the code for the test field:
Code:
<!--- Test Form --->
<form onsubmit="showFont(); return false" action="" name="myForm">
<input name="style" />
<input type="button" onclick="showFont()" value="Get Font" />
</form>

Here's the javascript for getting the font attribute:
Code:
<!--- getFont code --->
<script>
function getFont(el,fontStyle)
{
	var x = document.getElementById(el);
	if (x.currentStyle)
		var customfont = x.currentStyle[fontStyle];
	else if (window.getComputedStyle)
		var customfont = document.defaultView.getComputedStyle(x,null).getPropertyValue(fontStyle);
	return customfont;
}

<!--- showFont code --->
function showFont()
{
	if (!document.createElement)
	{
		alert();
		return;
	}
	var fontfamily = document.forms['myForm'].style.value;
	if (fontfamily) var customfont = getFont('TArea',fontfamily);
	alert(fontfamily + ' = ' + customfont);
}
</script>