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

📄 todaylongioninfo.aspx

📁 程序中带有大量的实例,采用多种方式优化代码,这初学者很好的学习资料
💻 ASPX
字号:
<%@ Page language="c#" Codebehind="TodayLongionInfo.aspx.cs" AutoEventWireup="false" Inherits="Web.TodayLongionInfo" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset= gb2312">
<STYLE type=text/css>A {
	TEXT-DECORATION: none
}
A:hover {
	TEXT-DECORATION: none
}
TD {
	FONT-SIZE: 12px
}
</STYLE>

<META content="MSHTML 6.00.3790.2817" name=GENERATOR></HEAD>
<BODY background="image/5.jpg">
<TABLE align=center valign=middle style="BACKGROUND-COLOR: transparent;Z-INDEX: 101; LEFT: 0px; WIDTH: 154px; POSITION: absolute; TOP: 0px; HEIGHT:147px" id="Table1" style="" cellSpacing="1" cellPadding="1" width="152">
  <TBODY>
  <TR>
    <TD style="LINE-HEIGHT: 20px;" valign=top><marquee behavior="scroll" direction="left"  scrollamount="1"><font color=blue>每日一言:</font></marquee>
      <DIV id=visible> <A id=hottext></A></DIV></TD></TR></TBODY></TABLE>




<DIV id=incoming style="DISPLAY: none">
<DIV id=AllNews>
<DIV id=1>
<DIV id=Summary><%=showtodaylogion()%></DIV>
<DIV id=NewsLink></DIV></DIV></DIV>
<DIV id=AddNews></DIV></DIV>
<SCRIPT language=JAVAscript>
<!--
// ------ 定义全局变量
       var theNewsNum;
		var theAddNum;
		var totalNum;
		var CurrentPosion=0;
       var theCurrentNews;
       var theCurrentLength;
       var theNewsText;   
       var theTargetLink;
       var theCharacterTimeout;
       var theNewsTimeout;
       var theBrowserVersion;
       var theWidgetOne;
       var theWidgetTwo;
       var theSpaceFiller;
       var theLeadString;
       var theNewsState;
       function startTicker()
       {               
// ------ 设置初始数值
          theCharacterTimeout = 200;//字符间隔时间
          theNewsTimeout     = 20000;//新闻间隔时间
          theWidgetOne        =  "_";//新闻前面下标符1
          theWidgetTwo        =  "-";//新闻前面下标符
          theNewsState       = 1;
          //theNewsNum        = document.body.children.incoming.children.NewsNum.innerText;//新闻总条数
          //add by lin
					theNewsNum        = document.body.children.incoming.children.AllNews.children.length;//新闻总条数
					theAddNum        = document.body.children.incoming.children.AddNews.children.length;//补充条数
					totalNum   =1;
					theCurrentNews     = 0;
          theCurrentLength    = 0;
          theLeadString       = " ";
          theSpaceFiller      = " ";
          runTheTicker();
       }
// --- 基础函数
       function runTheTicker()
       {
          if(theNewsState == 1)
          {
            if(CurrentPosion<theNewsNum){ 
						    setupNextNews();
            }
						else{
						    setupAddNews();
						}
						CurrentPosion++;
						if(CurrentPosion>=totalNum||CurrentPosion>=5) CurrentPosion=0;  //最多条数不超过5条
					}
          if(theCurrentLength != theNewsText.length)
          {
             drawNews();
          }
          else
          {
             closeOutNews();
          }
       }
// --- 跳转下一条新闻
       function setupNextNews()
       {
          theNewsState = 0;
					theCurrentNews = theCurrentNews % theNewsNum;     
          theNewsText = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.Summary.innerText;
          theTargetLink = document.body.children.incoming.children.AllNews.children[theCurrentNews].children.NewsLink.innerText;          
          theCurrentLength = 0;
          document.all.hottext.href = theTargetLink;
          theCurrentNews++;
			 }
       function setupAddNews()
       {
          theNewsState = 0;
					theCurrentNews = 1;     
          theNewsText = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.Summary.innerText;
          theTargetLink = document.body.children.incoming.children.AddNews.children[theCurrentNews].children.NewsLink.innerText;          
          theCurrentLength = 0;
          document.all.hottext.href = theTargetLink;
          theCurrentNews++;
			 }			 
// --- 滚动新闻
       function drawNews()
       {
          var myWidget;       
          if((theCurrentLength % 2) == 1)
          {
             myWidget = theWidgetOne;
          }
          else
          {
             myWidget = theWidgetTwo;
          }
          document.all.hottext.innerHTML = theLeadString + theNewsText.substring(0,theCurrentLength) + myWidget + theSpaceFiller;
          theCurrentLength++;
          setTimeout("runTheTicker()", theCharacterTimeout);
       }
// --- 结束新闻循环
       function closeOutNews()
       {
          document.all.hottext.innerHTML = theLeadString + theNewsText + theSpaceFiller;
          theNewsState = 1;
          setTimeout("runTheTicker()", theNewsTimeout);
       }      
window.onload=startTicker;        
//-->
</SCRIPT>
</BODY></HTML>

⌨️ 快捷键说明

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