当用户使用Alt&数字键盘将文本输入文本框 [英] What event fires when user uses Alt & numeric key pad to enter text into a textbox

查看:80
本文介绍了当用户使用Alt&数字键盘将文本输入文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的应用程序中,我们添加了一些JavaScript,用于将标题更新为用户在文本框中输入的
。为了触发这一点,我们修补了onkeyup

和onpaste。事件:


FirstName.Attributes(" onkeyup")=" ChangeTitle();"

FirstName.Attributes(" onpaste")= " ChangeTitle();"


如果用户碰巧使用标准输入外国字符,这些事件都不会触发Windows ALT键加数字

键盘,例如Alt-0225生成á。


任何人都知道在这种情况下应该处理哪些事件?


谢谢,Rob。

解决方案

当文本发生变化时,我认为''onchange''或

' 'ontextchange''或类似的东西


Rob Nicholson <在****** @ community.nospam>在消息中写道

新闻:OJ ************** @ TK2MSFTNGP15.phx.gbl ...

在我们的申请中,我们''添加了一些JavaScript更新标题
用户键入文本框。为了触发这一点,我们修补了
onkeyup
和onpaste。事件:

FirstName.Attributes(" onkeyup")=" ChangeTitle();"
FirstName.Attributes(" onpaste")=" ChangeTitle();"

如果用户碰巧使用标准Windows ALT键和数字键盘输入外国字符,这些事件都不会触发,例如Alt-0225生成á。

任何人都知道在这种情况下应该处理哪些事件?

谢谢,Rob。





" Rob Nicholson"写道:

在我们的应用程序中,我们添加了一些JavaScript,用于将用户键入的标题更新为文本框。为了触发这一点,我们修补了onkeyup
和onpaste。事件:

FirstName.Attributes(" onkeyup")=" ChangeTitle();"
FirstName.Attributes(" onpaste")=" ChangeTitle();"

如果用户碰巧使用标准Windows ALT键和数字键盘输入外国字符,这些事件都不会触发,例如Alt-0225生成??。

任何人都知道在这种情况下应该处理哪些事件?




OnKeyPress


< html>< body>

< SCRIPT>

function fnKeyPress()

{

oFirstNameCopy.value + = String.fromCharCode(event.keyCode);

}

< / SCRIPT>

< table>

< tr>

< td>名字< / td>

< ; td>

< INPUT ID =" oFirstName" TYPE ="文本" onKeyPress =" fnKeyPress();">

< / td>

< td>

名字副本

< / td>

< td>

< INPUT ID =" oFirstNameCopy" TYPE ="文本" >

< / td>

< / tr>

< / table>

< ; / body>

< / html>


-

Phillip Williams
http://www.societopia.net
http://www.webswapp.com


>在我们的应用程序中,我们添加了一些JavaScript更新标题

用户键入文本框。要触发此操作,我们会修补
onkeyup。和onpaste事件:

FirstName.Attributes(" onkeyup")=" ChangeTitle();"
FirstName.Attributes(" onpaste")=" ChangeTitle();"

如果用户碰巧使用标准Windows ALT键和数字键盘输入外国字符,这些事件都不会触发,例如Alt-0225会生成á。

任何人都知道在这种情况下应该处理哪些事件?




这个发布了一个MSDN友好的电子邮件地址 - 不是某人来自

微软应该评论?


谢谢,Rob。


In our application, we''ve added a bit of JavaScript that updates a title as
the user types into a textbox. To trigger this, we patch into the "onkeyup"
and "onpaste" events:

FirstName.Attributes("onkeyup") = "ChangeTitle();"
FirstName.Attributes("onpaste") = "ChangeTitle();"

This works a treat but neither of these events fire if the user happens to
enter a foreign character using the standard Windows ALT key plus numberic
keypad, e.g. Alt-0225 generates "á".

Anyone got any idea which, if, any event to handle for this situation?

Thanks, Rob.

解决方案

what about the event for when text changes, I think ''onchange'' or
''ontextchange'' or something like that

"Rob Nicholson" <in******@community.nospam> wrote in message
news:OJ**************@TK2MSFTNGP15.phx.gbl...

In our application, we''ve added a bit of JavaScript that updates a title
as
the user types into a textbox. To trigger this, we patch into the
"onkeyup"
and "onpaste" events:

FirstName.Attributes("onkeyup") = "ChangeTitle();"
FirstName.Attributes("onpaste") = "ChangeTitle();"

This works a treat but neither of these events fire if the user happens to
enter a foreign character using the standard Windows ALT key plus numberic
keypad, e.g. Alt-0225 generates "á".

Anyone got any idea which, if, any event to handle for this situation?

Thanks, Rob.




"Rob Nicholson" wrote:

In our application, we''ve added a bit of JavaScript that updates a title as
the user types into a textbox. To trigger this, we patch into the "onkeyup"
and "onpaste" events:

FirstName.Attributes("onkeyup") = "ChangeTitle();"
FirstName.Attributes("onpaste") = "ChangeTitle();"

This works a treat but neither of these events fire if the user happens to
enter a foreign character using the standard Windows ALT key plus numberic
keypad, e.g. Alt-0225 generates "??".

Anyone got any idea which, if, any event to handle for this situation?



OnKeyPress

<html><body>
<SCRIPT>
function fnKeyPress()
{
oFirstNameCopy.value += String.fromCharCode(event.keyCode);
}
</SCRIPT>
<table>
<tr>
<td>First Name</td>
<td>
<INPUT ID="oFirstName" TYPE="text" onKeyPress="fnKeyPress();">
</td>
<td>
Copy of First Name
</td>
<td>
<INPUT ID="oFirstNameCopy" TYPE="text" >
</td>
</tr>
</table>
</body>
</html>

--
Phillip Williams
http://www.societopia.net
http://www.webswapp.com


> In our application, we''ve added a bit of JavaScript that updates a title
as

the user types into a textbox. To trigger this, we patch into the "onkeyup" and "onpaste" events:

FirstName.Attributes("onkeyup") = "ChangeTitle();"
FirstName.Attributes("onpaste") = "ChangeTitle();"

This works a treat but neither of these events fire if the user happens to
enter a foreign character using the standard Windows ALT key plus numberic
keypad, e.g. Alt-0225 generates "á".

Anyone got any idea which, if, any event to handle for this situation?



This was posted with a MSDN friendly email address - isn''t somebody from
Microsoft supposed to comment?

Thanks, Rob.


这篇关于当用户使用Alt&amp;数字键盘将文本输入文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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