zoukankan      html  css  js  c++  java
  • [原创]用JS做的一个打字程序(为网友qixiao)

    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="JSTestSpeed.aspx.vb" Inherits="zero.JSTestSpeed"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
     <HEAD>
      <title>JSTestSpeed</title>
      <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
      <meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
      <meta name="vs_defaultClientScript" content="JavaScript">
      <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
      <Script language="javaScript">
      var str="dsafadsadsf wagfansgasdfaf; asdf;asf sadfasdfsdfsafasdfasfdasfdsafsfsasdfasff";
      var textLength = 60;
      var subStr = "";
      var j=1;
            var tRow=Math.round(str.length/textLength)+1;
           
            var RowMax=0;
      for(i=0;i<str.length;i++){
       subStr = str.substring(i,i+textLength);
       document.write("<input type='text' name='res"+j+"' readonly maxlength="+textLength+" class='res' value='"+subStr+"'>");
       if (subStr.length<textLength)
       RowMax=subStr.length;
       else
       RowMax=textLength;
       document.write("<input type='text' name='des"+j+"'  maxlength="+RowMax+" class='des' onkeyup=checkThis(res" +j+",des" +j+ ","+j+")>");
       document.write(" 本行错误数:<input type='text' name='erow"+j+"' style='30px' value=0 >");
          document.write("<p>");
       i=i+textLength-1;
       j=j+1;
       
      }
      
      function checkThis(obj1,obj2,j){
      
       var str1 = obj1.value;
       var str2 = obj2.value;
       
       var t=0;
       var rN=0;
                var theNumber = 0;
       for(i=0;i<str1.length;i++){
        if(str1.substring(i,i+1)!=str2.substring(i,i+1) && str2.substring(i,i+1)!="")
         theNumber=theNumber+1;
        else if (str2.substring(i,i+1)!="")
            rN=rN+1;
        
       }
          document.getElementsByName("erow"+j).item(0).value=theNumber;
          for (var s=1;s<=tRow;s++)
           t=t+parseInt(document.getElementsByName("erow"+s).item(0).value);
      
       document.all("theNumber").value=t;
       document.all("rN").value=rN;
      
      }
      
       
      
      </Script>
      <style>
       body,input{font-size:12px;font-family:verdana;}
      .res{ color:white;80%; background-color:royalblue;border:1px solid gray;}
      .des{ color:green;80%;border:1px solid gray;}
      input{border:1px solid gray;}
      </style>
     </HEAD>
     <body MS_POSITIONING="GridLayout">
      <form id="Form1" method="post" runat="server">
       总错误数目:<input type="text" name="theNumber" readonly value="0" style="30px"> &nbsp;正确数目:<input type="text" readonly name="rN" value="0" style="30px">
      </form>
     </body>
    </HTML>
  • 相关阅读:
    mysql 递归查找菜单节点的所有子节点
    mapStruct笔记
    JavaBean映射工具dozer学习
    常见Bean映射工具分析评测及Orika介绍
    Java 实体-实体的映射框架
    实体类与实体DTO类之间的转换
    推荐一个 Java 实体映射工具 MapStruct
    java Web项目Service层通用接口和entityVo对象与entity对象转化问题的解决方案
    SpringData JPA进阶查询—JPQL/原生SQL查询、分页处理、部分字段映射查询
    JPA框架下使用纯粹的原生SQL
  • 原文地址:https://www.cnblogs.com/goody9807/p/188553.html
Copyright © 2011-2022 走看看