从右到左文本HTML输入 [英] Right to left Text HTML input

查看:176
本文介绍了从右到左文本HTML输入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的网站,我需要提供阿拉伯语支持。它的一部分是提供输入文本框,当用户输入时,新的字符必须附加到左边,文本必须正确对齐。

For my website, i need to provide arabic support. Part of it is to provide input textboxes where when user types in, the new characters have to be appended to the left and the text has to be right aligned.

css属性到

text-align:right

没有工作,因为我不能得到光标来到左边,并在那里添加字母。所以我删除了该属性并添加了

didn't work, as i could not get the cursor to come to the left and add letters there. So I removed that property and added

direction:RTL

这里,光标移到左边,文本右对齐。但新添加的字符未附加到左侧。

Here, the cursor came to the left and text was right aligned. but the newly added characters were not getting appended to the left. Instead they were getting appended to the right end only.

如何解决这个问题?请帮助..

How do I fix this? please help..

例如,请参见google阿拉伯语页面搜索框。我需要确切的行为,虽然不是与那些花哨的键盘图标等, http://www.google.com/webhp? hl = ar

For example, see the google arabic page search box. I need the exact behavior, although not with those fancy keyboard icon etc., http://www.google.com/webhp?hl=ar

推荐答案

这里是我能想到的:


  • 使用 direction:RTL 作为RIGHT对齐

  • event:onkeyup,它执行将输入字符移到LEFT(进行一些文本处理)。

  • Use direction:RTL for the RIGHT alignment
  • Write a JavaScript handler attached to the event: "onkeyup", which performs the shifting of the entered character to the LEFT (doing some text processing).

这篇关于从右到左文本HTML输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆