控制键码的输入

hnalbert 2000-07-16 05:58:00
在用户输入信息时,通常会不让用户输入一些特定键码。如何在input 框中当用户输入了这些键码时不会显示出来,并显示一消息框给以提示?最好请给出源码。
...全文
224 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
hhzh426 2000-09-03
  • 打赏
  • 举报
回复
<script language="javascript">
function keypress()
{
....
}
</script>
<form....>
<input ... onkeydown="keypress()"...
VictorYu 2000-07-18
  • 打赏
  • 举报
回复
my mail is yyu@enet.com.cn.
hnalbert 2000-07-18
  • 打赏
  • 举报
回复
Do you have your way to refresh the page? I mean you needn't solve my question above,you can just give me your way to do chatroom . If you have some source code, please email me by hnalbert@sina.com. May you give me your email so that I can send my source code to you for your detail examing.

Albert
VictorYu 2000-07-18
  • 打赏
  • 举报
回复
我试了试,没有想出好的方法.如果有, 我会发Mail给你.
VictorYu 2000-07-17
  • 打赏
  • 举报
回复
把下面这个INPUT放在你的网页上看看
<input width=100 onkeypress="if(event.keyCode == 32) {alert('不能输入空格!!');event.returnValue = false;return;}">

其中32是空格键的KEYCODE;
你可以看看输入空格的郊果.呵呵
给点分罗
hnalbert 2000-07-17
  • 打赏
  • 举报
回复
Yes,well done! You can get the full points later.
Can you answer the following question, if so, you can claim more points.

Q: I met a question in programming a chatroom.
There is a sentence in the head of the chatroom.asp:
<meta http-equiv="refresh" content="30,url="...">
so that this page will refresh every 30 seconds. But if some one
submit his talk,there will be a msgbox appear saying "repost form
data" in his page .But if some one don't spethe msgbox ak, will not
appear in his page forever.I just suspect that:In the speaker's page,
can not include the sentence <.. http-equiv="refresh" ..>.If so,how
can the speaker refresh his page if he don't speak in several minutes?

please give me an answer.
Albert



hnalbert 2000-07-16
  • 打赏
  • 举报
回复
是的。
1. 怎样得到keycode?
2. 得到后,如为不允许的,该怎样使它无效,即不会显示出来?
3. Alert() 用户。

please show me a example,will you?
Thanks!
VictorYu 2000-07-16
  • 打赏
  • 举报
回复
可以响应onkeypress的消息。在这个消息是可以得到Event的KeyCode。如果不是你允许的。可以Alert()出来。你有什么具体的要求吗?

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧