Random typewriter time effect

Source: Internet
Author: User

<! Doctype HTML>
<HTML>
<Head>
<Meta charset = "UTF-8">
<Title> untitled document </title>
<SCRIPT>
Window. onload = function ()
{
VaR obtn = Document. getelementbyid ('btn ');
VaR obox = Document. getelementbyid ('box ');
VaR otex = Document. getelementbyid ('tex ');
Obtn. onclick = function ()
{
VaR value = otex. value;
If (! Value)
{
Alert ('Enter the content ');
Return;
};
VaR n = 0;
SetTimeout (F, RND (60,500 ));

Function f (){

N ++;
Obox. innerhtml = value. substring (0, n) + '<span >_</span> ';
If (n = value. length)
{

Obox. innerhtml = value. substring (0, N );
Alert ('callback ');
}
Else
{
SetTimeout (F, RND (60,500 ));
};
};

};
};

Function RND (n, m)
{
Return parseint (math. Random () * (m-n + 1) + n );
};
</SCRIPT>

</Head>

<Body>
<Input type = "button" value = "AA" id = "BTN">
<Textarea id = "Tex"> </textarea>
<Div id = "box" style = "width: 500px; Border: 1px solid #000; Height: 500px;"> </div>
</Body>
</Html>

 

 

Random typewriter time effect

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.