Hi All

I'm trying to change the background colour of a table cell (or layer - wotever) according to the figure entered into a text input. The idea is for a user to type in a hexadecimal colour code (eg. #ffffff) and see a preview of that colour in a box. The box is currently defined by a small table but this could be anything. The code I've currently got is this:
Code:
<script language="JavaScript">
<!--
function updatePreview() {
fgc = document.form1.fontcolour.value;
document.getElementByID(prevFontColor).style.background = fgc;

}
-->
</script>

<input name="fontcolour" type="text" id="fontcolour" value="#000000" size="10" maxlength="7" onblur="updatePreview();">

<table width="14" height="14" border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">
<tr> 
<td style="background-color: #000000" id="prevFontColor" width="12" height="12">
<img width="12" height="12" border="1" alt="" src="../files/spacer.gif">
</td>
</tr>
</table>
Can anyone help?
Cheers,