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 -->

posted @   G-Beniot  阅读(400)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
历史上的今天:
2014-05-30 php win主机下实现ISAPI_Rewrite伪静态
2014-05-30 php 伪静态 (url rewrite mod_rewrite 重写)
2014-05-30 liunx下vi命令详解
2014-05-30 能将0和1两个数字玩的如此传神!是个程序要都应该了解的海明码(通俗版)
2014-05-30 Linux 文件及文件夹权限
2014-05-30 CentOS如何分区
2014-05-30 入门必须掌握8个DOS命令
点击右上角即可分享
微信分享提示