0

我的网页中有一个 html 文本框。我可以在文本框中使用 Alt0128 输入欧元符号,但在另一个键盘上,我们使用 Altgr + e 输入欧元符号,但我无法在该键盘上使用此组合在html 文本框。我需要添加一些属性吗?这是我的文本框:

</td>
        <td class="contentCell" colspan="3" ">
            [#txt|txtmyBox#]
        </td>
4

1 回答 1

1

The effect of things like AltGr E depends on the keyboard driver (keyboard setup), not on your HTML code. You might be able to interfere using JavaScript, recognizing which keys were pressed, but this could be very risky. For all that we can now, AltGr E may have any meaning in a user’s keyboard, and making it produce something different could be very confusing (and might prevent the user from typing what he wants to type).

In principle, HTML5 drafts propose an inputMode attribute that could affect the keyboard setup, but probably only on touch screens. And it has not been implemented, and the current drafts don’t have anything related to typing currency symbols.

What you could do without disturbing keyboard settings is to add a button on the page, with “€” on it, so that clicking on that buttom appends the euro sign to the input value. This would be rather straightforward to do in JavaScript.

于 2013-10-10T13:10:17.790 回答