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>


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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存