本文实例讲述了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;\">phpstudy</div>
</body>
</html>
希望本文所述对大家的javascript程序设计有所帮助。
本文地址:https://www.stayed.cn/item/8706
转载请注明出处。
本站部分内容来源于网络,如侵犯到您的权益,请 联系我