控制键码的输入

hnalbert 2000-07-16 05:58:00
在用户输入信息时,通常会不让用户输入一些特定键码。如何在input 框中当用户输入了这些键码时不会显示出来,并显示一消息框给以提示?最好请给出源码。
...全文
225 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()出来。你有什么具体的要求吗?
单片机简介 一台能够工作的计算机要有这样几个部件构成:CPU(进行运算、控制)、 RAM (数据存储)、ROM(程序存储)、输入/输出设备(例如:串行口、并行输出口 等)。在个人计算机上这些部件被分成若干块芯片,安装一个称之为主板的印刷 线路板上。而在单片机中,这些部件全部被做到一块集成电路芯片中,所以就称 为单片机(也称微控制器 MCU),而且有一些单片机中除了上述部份外,还集成 了其它部份如 A/D,D/A 等。体积不大,一般用 40 脚封装, 当然功能多一些 单片机也有引脚比较多的, 如 68 引脚, 功能少的只有 10 多个或 20 多个引 脚,有的甚至只 8 只引脚。 1.2 51 单片机简介 51 单片机是对所有兼容 Intel 8031 指令系统的单片机的统称。该系列单片 机的始祖是 Intel 的 8004 单片机,后来随着 Flash rom 技术的发展,8004 单片 机取得了长足的进展,成为应用最广泛的 8 位单片机之一,其代表型号是 ATMEL 公司的 AT89 系列,它广泛应用于工业测控系统之中。很多公司都有 51 系列的兼 容机型推出,今后很长的一段时间内将占有大量市场。51 单片机是基础入门的 一个单片机,还是应用最广泛的一种。需要注意的是 51 系列的单片机一般不具 备自编程能力。 80C51 是 MCS-51 系列中的一个典型品种;其它厂商以 8051 为基核开发出的 CMOS 工艺单片机产品统称为 80C51 系列。 当前常用的 80C51 系列单片机主要产 品有: Intel(英特尔)的:i80C31、i80C51、i87C51,i80C32、i80C52、i87C52 等; ATMEL(艾德梅尔)的:AT89C51、AT89C52、AT89C2051,AT89S51(RC),AT89S52 (RC)等; Philips(飞利浦)、华邦、Dallas(达拉斯)、Siemens(西门子)等公司的许多产品

28,390

社区成员

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

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