[Javascript] How to enlarge and small the font

html code:

代码
<a href="####" id="zoom_minify">Zoom In</a>
<a href="####" id="zoom_magnify">Zoom Out</a>

 

js code:

代码
<script type="text/javascript">
$(
'#zoom_minify').click(function(){
textZoom(
-1);
});
$(
'#zoom_magnify').click(function(){
textZoom(
1);
});
function textZoom(i){
var newSize = Number($('body').css('font-size').substring(0, $('body').css('font-size').length-2)) + i;
$(
'body').css('font-size', newSize);
}
</script>

 

posted @ 2010-08-17 19:14  DavidHHuan  阅读(335)  评论(0编辑  收藏  举报