Home  >  Article  >  Web Front-end  >  js text box moving marquee effect code sharing_javascript skills

js text box moving marquee effect code sharing_javascript skills

WBOY
WBOYOriginal
2016-05-16 15:42:521989browse

The example in this article describes the js implementation of the text box moving marquee effect. Share it with everyone for your reference. The details are as follows:

Operation rendering:

Tips: Just copy the code shared below to run it. You can customize the text.
The js code shared with everyone to realize the text box moving marquee effect is as follows

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>文本框走动跑马灯代码</title>
</head>
<SCRIPT Language="JavaScript">

var msg="欢迎访问脚本之家 www.jb51.net";
var interval = 100;
var space10="";
var seq=0;

function Scroll() {
document.tmForm.tmText.value = msg.substring(seq, msg.length) + space10 + msg.substring(0, msg.length);
seq++;seq++;
if ( seq > msg.length ) { seq = 0 };
window.setTimeout("Scroll();", interval );
} 

</SCRIPT>

<BODY OnLoad="Scroll();" >

<CENTER><FORM Name=tmForm>
<INPUT Type=Text Name=tmText Size=45>
</FORM></CENTER>


<body>
</body>
</html>

The above is the js code shared with you to implement the text box moving marquee effect. I hope you can like it.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn