Home > Web Front-end > JS Tutorial > body text

JavaScript news ticker example code_javascript skills

WBOY
Release: 2016-05-16 15:24:03
Original
1252 people have browsed it

The example in this article shares with you the marquee effect code implemented in javascript, which implements functions such as news announcements. The following is a marquee example for your reference. I hope it can be helpful to friends in need.

Operation rendering:

The code example is as follows:

<!DOCTYPE html> 
<html> 
<head> 
<meta charset="gb2312"> 
<title>javascript新闻跑马灯效果</title>
</head>
<script type="text/javascript">
var msg="脚本之家欢迎您http://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>
Copy after login

I hope this article will be helpful to everyone in learning javascript programming.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!