📄 default.aspx
字号:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head runat="server">
<title>文字逐个闪烁</title>
</head>
<body>
<script language="JavaScript">
ShowText="欢迎来到诚讯电子科技"; //显示的文字
Color1 = "red"; //文字的颜色
Color2 = "#32cd32"; //转换的颜色
FontSize = "5"; //字体大小
SwitchSpeed = 500; //转换速度 (1000 = 1 秒)
m = 0;
if (navigator.appName == "Netscape")
{
document.write("<layer id=a visibility=show></layer><br><br><br>");
}
else
{
document.write("<div id=a></div>");
}
function ChangeShowTextColor()
{
if (navigator.appName == "Netscape") //如何为Netscape浏览器
{
document.a.document.write("<center><font face=arial size =" + FontSize + "><font color=" + Color1 + ">");
for (var n = 0; n < ShowText.length; n++)
{
if(n == m)
{
document.a.document.write("<font face=arial color=" + Color2 + ">" + ShowText.charAt(m) + "</font>");
}
else
{
document.a.document.write(ShowText.charAt(n));
}
}
document.a.document.write('</font></font></center>');
document.a.document.close();
}
if (navigator.appName == "Microsoft Internet Explorer") //如果为IE浏览器
{
string = "<center><font face=arial size=" + FontSize + "><font color=" + Color1 + ">";
for (var n = 0; n < ShowText.length; n++)
{
if( n == m)
{
string += "<font face=arial color=" + Color2 + ">" + ShowText.charAt(m) + "</font>";
}
else
{
string += ShowText.charAt(n);
}
}
string += "</font></font></center>";
a.innerHTML = string;
}
(m == ShowText.length) ? m=0 : m++;
}
setInterval("ChangeShowTextColor()", SwitchSpeed);//设置函数ChangeShowTextColor()执行所间隔的时间
</script>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -