⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lighttext.htm

📁 JavaScript编程实例2
💻 HTM
字号:
<html>
<head>
  <title>
    光晕效果的文字
  </title>

  <script language="JavaScript">
  <!--
    var thissize=20
    var textfont="隶书"
    
    //所有亮度色彩信息
    var textcolor= new Array()    
    textcolor[0]="000000"
    textcolor[1]="000000"
    textcolor[2]="000000"
    textcolor[3]="111111"
    textcolor[4]="222222"
    textcolor[5]="333333"
    textcolor[6]="444444"
    textcolor[7]="555555"
    textcolor[8]="666666"
    textcolor[9]="777777"
    textcolor[10]="888888"
    textcolor[11]="999999"
    textcolor[12]="aaaaaa"
    textcolor[13]="bbbbbb"
    textcolor[14]="cccccc"
    textcolor[15]="dddddd"
    textcolor[16]="eeeeee"
    textcolor[17]="ffffff"
    textcolor[18]="ffffff"
    
    //所有文本信息
    var message = new Array()
    message[0]="欢迎光临清华园"
    message[1]="请四处走走"
    message[2]="你会有更多的收获"
    message[3]="请再次光临"
    
    var i_strength=0//记录文字颜色号是第几号
    var i_message=0//记录目前是第几条记录
    var timer//设置递归调用的时间间隔
    
    //加亮函数
    function glowtext() 
    { 
      if(document.all) //判断IE的版本必须在4.0以上
      {
        if(i_strength <=17) 
        {
          glowdiv.innerText=message[i_message]//设置glowdiv的innerText属性为第某条文本
          document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"//设置光晕效果
          i_strength++//加亮
          timer=setTimeout("glowtext()",100)
        }
        else 
        {
          clearTimeout(timer)//取消上面的setTimeout函数的效果
          setTimeout("deglowtext()",1500)//重新设置setTimeout函数,加亮完毕,开始减亮。
        }
      } 
    }

    //减亮函数
    function deglowtext() 
    { 
      if(document.all) 
      {
        if(i_strength >=0) 
        {
          glowdiv.innerText=message[i_message]
          document.all.glowdiv.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"
          i_strength--//减亮
          timer=setTimeout("deglowtext()",100)
        }
        else 
        {
          clearTimeout(timer)
          i_message++//文本从加亮到减亮后开始显示下一个文本
          if(i_message>=message.length) //显示完所有的文本再从头开始显示
          {
            i_message=0
          }
          i_strength=0//显示下一个文本也从第一种亮度开始
          intermezzo()//两个文本的显示期间要间隔一定的时间
        }
      } 
    }

    //两个文本之间的设置时间间隔函数
    function intermezzo() 
    { 
      glowdiv.innerText=""//不显示任何文本
      setTimeout("glowtext()",1000) //间隔一秒钟
    }

  //-->
</script>
</head>

<body bgcolor="#fef4d9" onLoad="glowtext()">
  <div id="glowdiv" style="position:absolute;visibility:visible;width:600px;text-align:center; top:35px;left:10px;font-family:隶书;font-size:30pt;color:000000">
  </div>
</body>
</html>









⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -