欢迎光临
我们一直在努力

JavaScript翻页程序

建站超值云服务器,限时71元/月

不知道你们最近忙不忙,反正我是忙得够呛。
要组织班上的活动,还要折腾我的新机器。(我新买的计算机,没买声卡,更可气的是没法上网)
昨天晚上看《鹿鼎记》觉得翻页太不舒服了,自己写了一个翻页的,javascript不能对一个text/plain类型的进行scroll,只好结合asp来做了。
reader.html
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=gb_2312-80">
<title>text auto scroll reader</title>

<base target="main">
head>

<body background="_themes/blends/blegtext.gif">

<form action="read.asp" method="post" name="test" onsubmit="init()" target="display">
  文件名:<input type="file" name="filename" size="15">   
  <input type="submit" value="view" name="b1">  
  <input type="button" name="b2" value="stop" onclick="stop()">  
  卷滚速度:<input type="text" name="speed" value="1" size="2">  
  <input type="button" value="改变速度" name="b3" onclick="change()">
</form>
<script language="javascript">
    var y = 0
    var flag = 0
    var speed = 1
    function init(){
        settimeout("scrolling()",2000);
        flag = 1;
        y = 0;
        return true;
    }
    function scrolling(){
        if (flag == 1) {
          parent.display.scroll(0,y);
              y= y + speed
              settimeout("scrolling()",5);
        }
    }
    function stop(){
       if ( flag == 1 ) {
            flag = 0;
            document.test.b2.value = "start";
   }
       else {
            flag = 1;
            document.test.b2.value= "stop";
            settimeout("scrolling()",500);
            }
      }
    function change(){
      speed = parseint(document.test.speed.value,10);
    }
</script>

</body>
</html>
=================================================================
display.asp
<html>

<head>
<meta http-equiv="content-type" content="text/html; charset=gb_2312-80">
<title>text display</title>
</head>

<body background="_themes/blends/blegtext.gif" bgproperties="fixed">
<%
const forreading = 1, forwriting = 2, forappending = 8
const tristateusedefault = -2, tristatetrue = -1, tristatefalse = 0
dim filename, fs, f, s , readf , skip , i
filename = request.form("filename")
set fs = server.createobject("scripting.filesystemobject")
if fs.fileexists(filename) then
    set f = fs.getfile(filename)
    set readf = f.openastextstream(forreading,tristatefalse)  
else
    response.write(filename & "此文件不存在!")
end if
i = 1
do while readf.atendofstream <> true
    s = readf.readline
    response.write cstr(i) & "  " &  s & "<br>"
    i = i + 1
loop
%>
</body>
</html>
  

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » JavaScript翻页程序
分享到: 更多 (0)

相关推荐

  • 暂无文章