用JS来调整DIV中文章字体的大小的问题

来源:百度知道 编辑:UC知道 时间:2024/05/10 00:47:15
我用这个JS来调整文章字体的大小
function changesize(size)
{
document.getElementById("article_content").style.fontSize =size+"px";
}
但是如果内容里面有html代码,如:<br>,<p>等什么的,那么就不起作用,但如果没有那些在内容里面,那么就起作用,请问这是怎么一回事呢,其中article_content是放文章内容的DIV

<body>
<script>
function changesize(size)
{
document.getElementById("article_content").style.fontSize =size+"px";
}
</script>
<div id="article_content">aaaaaaaaaa<br/>bbbbbbbbbbb<p>ccccccccccccc</div>
<a href="javascript:changesize('20')">ChangeSize</a>
</body>