html中的文字逐渐显示的代码是什么?

html中的文字逐渐显示的代码是什么?,第1张

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<style>

div{

width:200px

height:30px

text-align:left

padding-left:20px

}

</style>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js">

</script>

<script>

$(document).ready(function(){

var arr = ["你","说","的","是","这","样","吗","?"]

var flag = 0

setInterval(function(){

if(flag == 9){

flag = 0

}

var str = ""

for(var i = 0i <flagi++){

str += arr[i]

}

$("div").html(str)

flag++

},600)

})

</script>

</head>

<body>

<div></div>

</body>

</html>

第一步:请修改<BODY>:

<BODY onload=init()>

第二步:将以下代码加入HEML的<BODY></BODY>之间

<script language=javascript>

var layers =document.layers,style=document.all,both=layers||style,idme=908601

if(layers){layerRef='document.layers'styleRef =''}if(style){layerRef='document.all'styleRef = <br/>'.style'}

function writeOnText(obj,str){

if(layers)with(document[obj]){ document.open()document.write(str)document.close()}

if(style)eval(obj+'.innerHTML=str')}

var dispStr=new Array("打字效果代码")//这里面的就是内容文字

var overMe=0

function txtTyper(str,idx,idObj,spObj,clr1,clr2,delay,plysnd){

var tmp0=tmp1= '',skip=100

if (both &&idx<=str.length) {

if (str.charAt(idx)=='<'){ while(str.charAt(idx)!='>') idx++idx++}

if (str.charAt(idx)=='&'&&str.charAt(idx+1)!=' '){ while (str.charAt(idx)!= '')idx++idx++}

tmp0 = str.slice(0,idx)

tmp1 = str.charAt(idx++)

if (overMe==0 &&plysnd==1){

if (navigator.plugins[0]){

if(navigator.plugins["LiveAudio"][0].type=="audio/basic" &&navigator.javaEnabled()){document.embeds<br/>[0].stop()<br/>setTimeout("document.embeds[0].play(false)",100)}

} else if (document.all){

ding.Stop()

setTimeout("ding.Run()",100)}

overMe=1}else overMe=0

writeOnText(idObj, "<span class="+spObj+"><font color='"+clr1+"'>"+tmp0+"</font><font color='"+clr2

+"'>"+tmp1+"</font></span>")

setTimeout("txtTyper('"+str+"', "+idx+", '"+idObj+"', '"+spObj+"', '"+clr1+"', '"+clr2+"', "+delay+" ,"+plysnd+")",delay)}}

function init(){txtTyper(dispStr[0], 0, 'ttl0', 'ttl1', '#339933', '#99FF33', 300, 0)}

</script>

<DIV class=ttl1 id=ttl0></DIV>

<html>

<head>

<title>网页特效-文本特效-渐显的文字提示效果</title>

<FCK:meta http-equiv="content-Type" content="text/htmlcharset=gb2312" />

<!--把下面代码加到<head>与</head>之间-->

<style type="text/css">

.lookMe{

float:left

margin-right:10px

padding:5px

width:90px

color:#0099FF

cursor:pointer

background:#FFFADC

border:1px solid #CC6600

}

.lookMe span{

display:none

position:absolute

padding:5px

width:200px

color:#CC3300

background:#FFFADC

border:1px solid #CC6600

filter:alpha(opacity=0)

}

</style>

</head>

<body>

<!--把下面代码加到<body>与</body>之间-->

<div onmouseover_fckprotectedatt="%20onmouseover%3D%22lookMe(this)%3B%22" class="lookMe" onmousemove_fckprotectedatt="%20onmousemove%3D%22mouseMove(event)%3B%22">闷战120分钟点球战4:2 西班牙破魔咒淘汰意大利

<span>1、雅虎体育讯 北京时间6月23日,欧洲足球锦标赛在瑞士奥地利继续进行,在一场四分之一决赛中,西班牙队迎来了上届世界杯冠军意大利队,90分钟与加时赛双方均一球未进,在最终的点球大战中,西班牙4:2击败了对手,昂首挺进四强。</span>

</div>

<div onmouseover_fckprotectedatt="%20onmouseover%3D%22lookMe(this)%3B%22" class="lookMe" onmousemove_fckprotectedatt="%20onmousemove%3D%22mouseMove(event)%3B%22">闷战120分钟点球战4:2 西班牙破魔咒淘汰意大利

<span>2、在一场四分之一决赛中……</span>

</div>

<div onmouseover_fckprotectedatt="%20onmouseover%3D%22lookMe(this)%3B%22" class="lookMe" onmousemove_fckprotectedatt="%20onmousemove%3D%22mouseMove(event)%3B%22">闷战120分钟点球战4:2 西班牙破魔咒淘汰意大利

<span>3、欧洲足球锦标赛在瑞士奥地利继续进行,在一场四分之一决赛中,西班牙队迎来了上届世界杯冠军意大利队,90分钟与加时赛双方均一球未进,在最终的点球大战中,西班牙4:2击败了对手,昂首挺进四强。</span>

</div>

<script>

var span,timer1

function lookMe(thisTag){

span = thisTag.getElementsByTagName('span')[0]

span.style.display = 'block'

span.filters[0].opacity=0

timer1=setInterval("showme()",10)

thisTag.onmouseout = function(){

span.style.display = 'none'

}

}

function showme()

{

if(span.filters[0].opacity==80){clearInterval(timer1)}

span.filters[0].opacity++

}

function mouseMove(event){

var xx=event.clientX + 5

var yy=event.clientY + 10

var obj = event.srcElement ? event.srcElement : event.target

var span=obj.getElementsByTagName("span")[0]

span.style.left = xx + 'px'

span.style.top = yy + 'px'

}

</script>

</body>

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/8283853.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-15
下一篇 2023-04-15

发表评论

登录后才能评论

评论列表(0条)

保存