JS实现文字放大效果的方法

时间:2015-03-03    点击:176   

本文实例讲述了JS实现文字放大效果的方法。分享给大家供大家参考。具体实现方法如下:

复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JS实现文字放大效果</title>
<script type="text/javascript">
  var n = 12;
  function chanTxt()
  {
    var obj = document.getElementById("test");
    if(n <= 42)
    {
      obj.style.fontSize = n+"px";
    }
 n++;
  }
</script>
</head>
<body>鼠标经过橙色部分
<div id="test" onmouseover="setInterval('chanTxt()',100)" style="width:300px; height:50px; font-size:12px; line-height:50px; background:#f90;">本站</div>
</body>
</html>

希望本文所述对大家的javascript程序设计有所帮助。

深入理解JavaScript系列(37):设计模式之享元模式详解
jQuery插件开发的五种形态小结
深入理解JavaScript系列(36):设计模式之中介者模式详解
百度UEditor编辑器如何关闭抓取远程图片功能
jQuery实现复选框成对选择及对应取消的方法
> 返回     
地址:上海市普陀区胶州路941号长久商务中心 电话: QQ:
© Copyright 2012 上海网络 Product All Rights Reserved