Using JavaScript script to achieve the scrolling effect of the method

  • 2020-07-21 06:49:04
  • OfStack

Many web friends often make bulletin boards, information Windows, but also often in order to realize the full page and image of the scroll display and worry, don't worry, here is a simple way to realize the scroll display. We did not use Java.class program to implement, is not dynamic DHTML language, but to make full use of JavaScript scripting language 1 function, write 1 short JavaScript scripting language can achieve this 1 function.

The original code is as follows:


<html>

  <head>

  <script language="Javascript">

  <!--// Prevent error display 

  locate=0;

  function my_scroller()

  {

   if (locate !=400 )

  {

   locate++;// Value increases 

   scroll(0,locate);

   clearTimeout(timer);

   var timer = setTimeout("my_scroller()",2);// Control rolling time 

   timer;

  }

  }

   -->

  </script>

  </head>

  <body OnLoad="my_scroller()">

 About the author: <br><br>

 Cui Tongjie male <br><br> Computer Center of Armed Police Engineering College <br><br>

 Zhang Weihua male <br><br> Armed Police Engineering College graduate team <br><br><br><br><br>

  <br><br><br><br><br><br>

 Contact Address: <br><br>

 Xi 'an Armed Police Engineering College Computer Center <br><br> Cui Tongjie <br><br></body>

  </html>

You can control the length of the display page by changing the value of Locate (Locate! = 400); Can modify "SetTimeout (" Scroller ()", 2);" To change the rolling speed. You may make some adjustments respectively. After the program is written and saved, it shall be debuggable on PII+PWS4.0+IE5 platform.

Simple? Go and have a try.


Related articles: