javascript实现d幕效果

javascript实现d幕效果,第1张

概述javascript实现d幕效果

下面是内存溢出 jb51.cc 通过网络收集整理的代码片段。

内存溢出小编现在分享给大家,也给大家做个参考。

<!DOCTYPE HTML PUBliC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/HTML4/loose.dtd"><HTML> <head>  <Title>JavaScriptd幕</Title>  <Meta http-equiv="Content-Type" content="text/HTML; charset=gb2312" />	<style>		#play{			wIDth:600px;			height:500px;			background-color:#000;		}				#tangmu{			wIDth:600px;			height:500px;			background-color:#fff;			z-index:9999;			background-color: rgba(000,1,000,0.1); 		}				#textStyle{			position:absolute;			Font-size:24px;			color:#fff;		}	</style>	 </head> <body> 	<div ID="play">		<div ID="tangmu">					</div>	</div>		<input type="text" ID="text" value="这是d幕..."/><input type="button" value="发送" onClick="tangmu();"/>		<script>		var si;		function tangmu(){			clearInterval(si);			var text = document.getElementByID("text");			var tangmu = document.getElementByID("tangmu");			var textStyle="<Font ID=\"textStyle\">"+text.value+"</Font>";						mathHeight = Math.round(Math.random()*tangmu.offsetHeight)+"px";			var textleft=tangmu.offsetWIDth+"px";						tangmu.INNERHTML=textStyle;						var textStyleObj = document.getElementByID("textStyle");						textStyleObj.style.left=textleft;			textStyleObj.style.top=mathHeight;						var x=parseInt(textStyleObj.style.left);						si = setInterval("xunhuan("+x+")",100);					}		function xunhuan(left){			var textStyleObj = document.getElementByID("textStyle");			textStyleObj.style.left=left;						var x=parseInt(textStyleObj.style.left);			if(x<textStyleObj.style.wIDth){				document.getElementByID("tangmu").INNERHTML="";				clearInterval(si);			}else{				x-=18;			}						textStyleObj.style.left=x+"px";		}	</script>	 </body></HTML>

以上是内存溢出(jb51.cc)为你收集整理的全部代码内容,希望文章能够帮你解决所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

总结

以上是内存溢出为你收集整理的javascript实现d幕效果全部内容,希望文章能够帮你解决javascript实现d幕效果所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

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

原文地址: http://outofmemory.cn/web/1092328.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存