当前位置:首页 > 网站应用 > 正文内容

打字机效果的带超链接的新闻标题

cjw1238个月前 (09-20)网站应用2110
<html>
<head>
<title>打字效果的带链接的新闻标题</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body{font-size:14px;font-weight:bold;}
</style>
</head>
<body>
最新内容:<a id="HotNews" href="" target="_blank"></a>
<SCRIPT>
<!--
var NewsTime = 2000;	//每条新闻的停留时间
var TextTime = 50;		//新闻标题文字出现等待时间,越小越快

var newsi = 0;
var txti = 0;
var txttimer;
var newstimer;

var newstitle = new Array();	//新闻标题
var newshref = new Array();		//新闻链接

newstitle[0] = "关于本站的相关说明";
newshref[0] = "http://#?ID=1";

newstitle[1] = "本站控制面板的使用方法介绍";
newshref[1] = "http://#?ID=2";

newstitle[2] = "添加了部分教程文章充实内容";
newshref[2] = "http://#?ID=3";

newstitle[3] = "完成留言板的修改";
newshref[3] = "http://#?ID=4";

newstitle[4] = "上千个精致特效持续添加中";
newshref[4] = "http://#?ID=5";

function shownew(){
	var endstr = "_"
	hwnewstr = newstitle[newsi];
	newslink = newshref[newsi];
	if(txti==(hwnewstr.length-1)){endstr="";}
	if(txti>=hwnewstr.length){
		clearInterval(txttimer);
		clearInterval(newstimer);
		newsi++;
		if(newsi>=newstitle.length){
			newsi = 0
		}
		newstimer = setInterval("shownew()",NewsTime);
		txti = 0;
		return;
	}
	clearInterval(txttimer);
	document.getElementById("HotNews").href=newslink;
	document.getElementById("HotNews").innerHTML = hwnewstr.substring(0,txti+1)+endstr;
	txti++;
	txttimer = setInterval("shownew()",TextTime);
}
shownew();
//-->
</SCRIPT>
</body>
</html>


扫描二维码推送至手机访问。

版权声明:本文由追求完美发布,如需转载请注明出处。

本文链接:https://www.cjw123.com/blog/?id=110

标签: htmlJS
分享给朋友:

相关文章

网站调整公告

        网站开通了也有三年多了,网站也进行了多次的改版,昨天是我生日嫌着没事在家里把网站再进行了一次改版,当大家再次访问网站时,网站已经换上了全新的衣裳,这次的改版也将意味着我自己也会以一个全新的面貌展现,在我过去的一岁里...

html meta标签屏蔽搜索引擎的用法

html页面中的 meta 标签可以用来识别搜索引擎的蜘蛛类型,可以规定meta标签所在的html页面是否被蜘蛛抓取,下面是这个meta标签的用法,大家可以借鉴一下。搜索引擎的 meta 标签的解析下面是meta标签对搜索引擎的解析<meta name='robot...

纸张撕裂动画效果,网站错误404页源码

一款挺好看的404页源码,可以改成自己想要的提示页<html>    <head>    <meta charset="UTF-8"> &nbs...

css中鼠标样式大全

<p>请把鼠标移动文字上,看看效果吧</p> <div style="cursor: pointer;">手形</div>  <div style="cursor:&nbs...

js文字定时向上滚动特效代码

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <t...

html中表table行循环滚动,类似车次、航班动态

<HTML> <meta charset="utf-8"> <HEAD> <TITLE>滚动表格</TITLE> <!--css样式是锁定表头不动的--> <style>&nb...

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。