js改变网页字体的大小

[ 不指定 2008/10/28 17:09 | by wxxslt ]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml...
<html xmlns="http://www.w3.org/1999/xht...
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
//Font size control
function doZoom(size) {
  document.getElementById('zoomtext').style.fontSize=size+'px';
}
</script>
</head>

<body>
<div>设置字体大小:<a href="javascript:doZoom(16);">大</a> <a href="javascript:doZoom(14);">中</a> <a href="javascript:doZoom(12);">小</a></div>
<div id="zoomtext">这个是要显示的字体大小</div>
</body>
</html>




Else写的,很简单,估计难的我也看不懂…确实不错,实用,记录下。
Tags: ,
学习心得 | Comments(0) | Trackbacks(0) | Reads(72)
Add a comment
Nickname [Register]
Password Optional
Site URI
Email
Enable HTML Enable UBB Enable Emots Hidden Remember