当前位置:Gxlcms > JavaScript > JS实现文字放大效果的方法

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

时间:2021-07-01 10:21:17 帮助过:6人阅读

本文实例讲述了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程序设计有所帮助。

人气教程排行