如何在编辑表格中的单元格时更改字体大小?



我正在开发一个电子表格编辑器。当我在编辑表中的特定单元格时,如何更改单元格的字体大小?我在这里使用了getElementById
Code:

<title>Gold Sheets</title>
<div id="toolbar">
<select name='Font Size' id="ft_size" onchange="changeSize(this);">
<option value="12">12</option>
<option value="14">14</option>
<option value="16" selected>16</option>
<option value="18">18</option>
<option value="24">24</option>
</select>
</div>
<script>
function changeSize(e) {
document.getElementById('textarea').style.fontSize = e.value + 'px'
}
</script>
<br>
<br>
<table>
<tr>
<td>1</td>
<td contenteditable id='textarea'></td>
<td contenteditable id='textarea'></td>
<td contenteditable id='textarea'></td>
</tr>
</table>

答案已清除,因为更改了问题

最新更新