经典论坛's Archiver

snwebsite 发表于 2008-5-27 18:10

改善用户体验的小技巧,表单输入中英文自动切换。

今天在百度贴吧发帖子发现,如果用中文填写完标题与内容再填写验证码时,需要进行中英文或大小写的切换。
当然不仅是填写英文字母的验证码,表单中填写email地址等地方也需要。
于是想了个办法,希望不要火星或画蛇添足。例子比较简单,一看就明白了。
ps:没测IE,用FF或SF看吧!


[html]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<style>
input,textarea {
        width:300px;
        height:20px;
        border:1px solid
        }
textarea {
        height:150px
        }
#pw {
        opacity:0;
        display:block;
        position:relative;
        margin-top:-24px
        }
#tt,#pw {
        width:100px
        }
</style>

<table>
        <tr>
                <td>标题</td>
                <td><input type="text"/></td>
        </tr>

        <tr>
                <td>内容</td>
                <td><textarea></textarea></td>
        </tr>

        <tr>
                <td>验证码</td>
                <td><input type="text" id="tt"/><input type="password" id="pw"/></td>
        </tr>
</table>

<script>
var ee = document.getElementById('pw');
ee.onkeyup = function p() {
    document.getElementById('tt').value = ee.value;
}
</script>[/html]

ibio 发表于 2008-5-27 19:20

恩.很棒!
找了好久了.呵呵!~谢拉!~

jsuper 发表于 2008-5-27 20:47

IE下测试通过
PS:为什么不希望大家用IE看呢?

doggic 发表于 2008-5-28 10:50

不懂什么原理

hysala 发表于 2008-5-28 14:16

虽然是解决了中文切换英文的问题,但是验证码输入框输入的内容为密码时,用户不清楚自己有没有填错

西贝 发表于 2008-5-28 14:19

其实很多都解决了这个问题了

页: [1]



Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.