代码驿站移动版
频道导航
HTML/Xhtml
CSS
JavaScript
HTML5
PHP教程
ASP.NET
正则表达式
AJAX
ThinkPHP
Yii
MySQL
MariaDB
Oracle
MongoDB
Redis
DedeCMS
PHPCMS
帝国CMS
WordPress
Discuz
其它CMS
Zend Studio
Sublime
Notepad
Dreamweaver
Windows
Linux
Nginx
Apache
IIS
CentOS
Ubuntu
Debian
网站优化
工具资源
PHP源码
ASP.NET源码
其它源码
图标素材
按钮素材
字体素材
DedeCMS模板
帝国CMS模板
PHPCMS模板
WordPress模板
Discuz!模板
单页模板
开发软件下载
服务器软件下载
广告投放
联系我们
版权申明
软件编程
网页前端
移动开发
数据库
服务器
脚本语言
PHP代码
JAVA代码
Python代码
Android代码
当前位置:
主页
> >
javascript实现的多条新闻公告系统
时间:2021-05-15 09:06:04 | 栏目: | 点击:次
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD><TITLE>公告系统</TITLE> <META http-equiv=Content-Type content="text/html; charset=gb2312"><!-- 原始颜色#5A614A --> <STYLE type=text/css>A:visited { COLOR: #5a614a; TEXT-DECORATION: none } A:link { COLOR: #5a614a; TEXT-DECORATION: none } A:hover { LEFT: 1px; FONT-FAMILY: 宋体; POSITION: relative; TOP: 1px } BODY { FONT-SIZE: 9pt; MARGIN: 0px; TEXT-ALIGN: left } </STYLE> <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 = 50;//字符间隔时间 theNewsTimeout = 3000;//新闻间隔时间 theWidgetOne = "_";//新闻前面下标符1 theWidgetTwo = "-";//新闻前面下标符 theNewsState = 1; //theNewsNum = document.body.children.incoming.children.NewsNum.innerText;//新闻总条数 //add by lin theNewsNum = document.getElementById("incoming").children.AllNews.children.length;//新闻总条数 theAddNum = document.getElementById("incoming").children.AddNews.children.length;//补充条数 totalNum =theNewsNum+theAddNum; 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.getElementById("AllNews").children[theCurrentNews].children.Summary.innerText; theTargetLink = document.getElementById("AllNews").children[theCurrentNews].children.NewsLink.innerText; theCurrentLength = 0; document.all.hottext.href = theTargetLink; theCurrentNews++; } function setupAddNews() { theNewsState = 0; theCurrentNews = theCurrentNews % theAddNum; theNewsText = document.getElementById("incoming").children.AddNews.children[theCurrentNews].children.Summary.innerText; theTargetLink = document.getElementById("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> <!-- 一种文字颜色渐变效果的超级连接特效 --> <SCRIPT> <!-- document.onmouseover = domouseover; document.onmouseout = domouseout; function domouseover() { if(document.all){ srcElement = window.event.srcElement; if (srcElement.className.indexOf("fade") > -1) { var linkName = srcElement.name; fadein(linkName); } } } function domouseout() { if (document.all){ srcElement = window.event.srcElement; if (srcElement.className.indexOf("fade") > -1) { var linkName = srcElement.name; fadeout(linkName); } } } function makearray(n) { this.length = n; for(var i = 1; i <= n; i++) this[i] = 0; return this; } hexa = new makearray(16); for(var i = 0; i < 10; i++) hexa[i] = i; hexa[10]="a"; hexa[11]="b"; hexa[12]="c"; hexa[13]="d"; hexa[14]="e"; hexa[15]="f"; function hex(i) { if (i < 0) return "00"; else if (i > 255) return "ff"; else return "" + hexa[Math.floor(i/16)] + hexa[i%16];} function setbgColor(r, g, b, element) { var hr = hex(r); var hg = hex(g); var hb = hex(b); element.style.color = "#"+hr+hg+hb; } function fade(sr, sg, sb, er, eg, eb, step, direction, element){ for(var i = 0; i <= step; i++) { setTimeout("setbgColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+ ")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");",i*step); } } function fadeout(element) { fade(255,153,0, 0,0,0, 30, 1, element); } /*------------------=[fadein]=---------------------- ||Fades the text from one color to another color || ||when the mouse moves over the link. || ||-------------------------------------------------*/ function fadein(element) { fade(0,0,0, 255,153,0, 18, 1, element); } /*ignore this >>>>*/ function fadeIn2(id){ fade(255,255,255, 88,118,152, 25, 1, id); } function fadeOut2(id){ fade(88,118,152, 255,255,255, 29, 1, id); } /*<<<<< stop ignoring =)*/ // --> </SCRIPT> <META content="MSHTML 6.00.3790.4064" name=GENERATOR></HEAD> <BODY bgColor=#fdf4bc> <DIV id=visible><FONT color=#ff6910>公告一句话:<A class=fade id=hottext href="https://www.jb51.net/" target=_blank name=a></A></DIV> <DIV id=incoming style="DISPLAY: none"> <DIV id=AllNews> <DIV id=1> <DIV id=Summary>1.应广大热爱本站的朋友的要求,本站已正式推出了"清萍学堂",专门制作视频教程给大家参考学习。 - 2007-7-10</DIV> <DIV id=NewsLink>fq/qpxt/</DIV></DIV> <DIV id=2> <DIV id=Summary>2.本站第一期电子杂志"flash特效"出世了,精美的画面、精美的内容、优美动听的音乐等你欣赏。 - 2007-5-31</DIV> <DIV id=NewsLink>flash/zazhi/</DIV></DIV> <DIV id=3> <DIV id=Summary>3.本站下载中心和关于我们已经成功改版了,两个风格都是以古典优雅、高风侠义为表现。 - 2007-7-1</DIV> <DIV id=NewsLink>/fq/</DIV></DIV> <DIV id=4> <DIV id=Summary>4.长期寻求QQ空间flash、flash网站、flash片头等业务制作,价格便宜、服务周到。- 2006-10-21</DIV> <DIV id=NewsLink>images/yewu.htm</DIV></DIV> <DIV id=5> <DIV id=Summary>5.★强烈推荐大家一款高速稳定、透明代理,安全的英文google浏览器。 点击即可下载→</DIV> <DIV id=NewsLink></DIV></DIV></DIV> <DIV id=AddNews></DIV></DIV></BODY></HTML>
[Ctrl+A 全选 注:
引入外部Js需再刷新一下页面才能执行
]
您可能感兴趣的文章:
docker 容器上编译 go 程序提示找不到文件问题
如何使win2003服务器自动定时重启的图文教程
R语言运行环境安装配置详解
Prototype1.6 JS 官方下载地址
如何将本地构建好的docker镜像发布到dockerhub
相关文章
05-10
基于react hooks,zarm组件库配置开发h5表单页面的实例代码
05-10
浅谈react路由传参的几种方式
05-10
英语常用口语扫盲啦.扫盲!
05-09
R语言求一行(列表、list)数据的平均数操作
05-09
Web网络安全解析宽字节注入攻击原理
JQuery
VUE
AngularJS
MSSql
MySQL
MongoDB
Redis
Linux
Tomcat
Nginx
网站首页
广告投放
联系我们
版权申明
联系站长