Javascript scroll up announcement (original)

Source: Internet
Author: User

<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Title> No title page </title>
</Head>
<Body>

<Div style = "width: 400px; Height: 23px; overflow: hidden; Background-color: Red">
<Div id = "noticev2" style = "white-space: nowrap;" onmouseover = "javascript: ismove = false" onmouseout = "javascript: ismove = true">
<A target = "_ blank" href = "http://zhidao.baidu.com/question/42884976.html? Fr = qrl "> what is JavaScript </a> <br>
<A target = "_ blank" href = "http://zhidao.baidu.com/question/41573038.html? Fr = qrl "> JavaScript Form Verification </a> <br>
<A target = "_ blank" href = "http://zhidao.baidu.com/question/37308454.html? Fr = qrl ">
What is the use of event objects in JavaScript? </A> <br>
<A target = "_ blank" href = "http://zhidao.baidu.com/question/35464099.html? Fr = qrl ">
Let's see what went wrong with JavaScript. Why can't I run it? </a> <br>
<A target = "_ blank" href = "http://zhidao.baidu.com/question/34079794.html? Fr = qrl ">
Javascript Form Verification: How to restrict the user password from entering only lowercase letters and underscores... </a>

</Div>
</Div>
<SCRIPT>
VaR tid;
VaR tn;
VaR nstoptime= 3000
VaR nspeed = 50
VaR ismove = true;
VaR nheight = 20;
VaR NS = 0
VaR nnewscount = 0

Function movet (N)
{
Cleartimeout (TID)
VaR noticev2 = Document. getelementbyid ("noticev2 ")
If (N)
{
Noticev2.style. lineheight = nheight + "PX ";
VaR thetext = noticev2.innerhtml. tolowercase ();
Nnewscount = thetext. Split ("<br>"). Length
Noticev2.innerhtml + = "<br>" + noticev2.innerhtml;
Tn = nheight;
}
NS = nspeed;
If (ismove)
{
Noticev2.style. margintop = tn + "PX ";
If (tn-2) % nheight = 0)
{
NS = nspeed + nstoptime;
}

TN --;
If (math. Abs (TN) = (nnewscount * nheight * 2-nheight ))
Tn = (nNewsCount-1) * nheight *-1;
}

Tid = setTimeout ("movet ()", NS );
}

Movet (1 );
</SCRIPT>


</Body>
</Html>
In this case, pay attention to the relationship between the Row Height and the nheight during actual use !!!

Related Article

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.