zoukankan      html  css  js  c++  java
  • input中如何输入逆写的中文句子

    <input style="text-align:right" />
    <input type="text" dir="rtl" />
    这两个都是从右往左输入(反向输入),但文字排列顺序还是从左往右的(顺序排列).
    另外还有反向输入反序排列


    <!-- TWO STEPS TO INSTALL REVERSE TEXT WIZARD:

    1. Copy the coding into the HEAD of your HTML document
    2. Add the last code into the BODY of your HTML document -->

    <!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

    <HEAD>

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    <!-- Original: David Hansen (b.o.b@compswizard.com) -->
    <!-- Web Site: http://www.compswizard.com -->
    <script language=javascript>

    <!--

    function reverseText(tName,fName) {
    if (event.keyCode == 8) {
    eval("document." + tName + "." + fName + ".value = ''");
    }
    if ((event.keyCode == 32) || ((event.keyCode >=48) && (event.keyCode <= 57)) || ((event.keyCode >= 65) && (event.keyCode <= 90)) || ((event.keyCode >= 186) && (event.keyCode <= 222))) {
    text = "";
    str = eval("document." + tName + "." + fName + ".value");
    i = 0;
    while (i <= (str.length - 1)) {
    if (i == (str.length - 1)) {
    text = str.substring(i, i+1) + text;
    } else {
    text += str.substring(i, i+1);
    }
    i++;
    }
    eval("document." + tName + "." + fName + ".value = text");
    }
    }

    //-->

    </script>

    </HEAD>

    <!-- STEP TWO: Copy this code into the BODY of your HTML document -->

    <BODY>

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->
    <!-- Original: David Hansen (b.o.b@compswizard.com) -->
    <!-- Web Site: http://www.compswizard.com -->
    <form name=testForm action="" method=post>

    <input name=testField type=text style="text-align:right" onKeyUp="reverseText('testForm','testField')">

    </form>

    <p><center>
    <font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
    by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
    </center><p>

    <!-- Script Size: 1.90 KB -->

  • 相关阅读:
    快速幂
    三角函数与反三角函数的使用
    poj1050 dp动态规划
    归并排序算法
    KMP算法(查找子序列)
    hdu1233 继续畅通工程 (最小生成树——并查集)
    set<pair<int,int> > 的运用
    HDU 4513 吉哥系列故事――完美队形II (manacher算法)
    Codeforces Round #360 (Div. 2) C. NP-Hard Problem (BFS)
    Codeforces Round #357 (Div. 2) C.Heap Operations 优先队列 + 模拟
  • 原文地址:https://www.cnblogs.com/Gbeniot/p/4540567.html
Copyright © 2011-2022 走看看