A random naming program that uses JavaScript

Source: Internet
Author: User
Tags setinterval

  This article mainly introduces the use of JavaScript to do a random naming process, tested, the effect is quite good, need friends can refer to the following

  Code as follows: <! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en"   "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" >  <html>  <head>  <meta http-equiv= "Content-type" content= "text/html; charset=gb2312 ">  <title> naming </title>  <script language=" javascript "type=" text/ JavaScript >  var status = 1;  var name = new Array (' Fan Peng ', ' Zhang Zihan ', ' Dawn ', ' Sun Ti ', ' Nate ', ' Wang Hong gang ', ' Zengfanding ', ' Li Huan ', ' Zhu Ying ', ' King Lisa ', ' Zheng Lin ', ' Zhu Zhenjia ', ' King One ', ' undeterred ', ' Gou super ', ' Wutongguang ', ' Liang Liang ', ' Liu June ',;    function getname () {  return Name[math.floor ( Math.random () *name.length)]; }  function showname () {  document.getElementById ("name"). InnerHTML = GetName ();  settimeout ("ShowName"); }  function goname () {  Intimer = SetInterval (ShowName, ; }  function Stopname () {  if (status = 1) {  clearinterval (intimer);  status = 0; }el se{  Intimer = setinterval (showname);  status = 1; }  }  </script>  <style>  #name {  border:1px solid #000;  margin:auto;  font-size:36px;  color: #000000;  width:108px;  height:1em;  cursor:pointer;  text-align: center; }  </style>  </head>  <body onload= "Goname ()" >  <div id= "name" Onclick= "Stopname ()" ></div>  </body>  </html>     

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.