在浏览器里很容易实现类似VB Form的文本框,按钮等控制
主要用到 keydown,keyup,keypress 等事件
对按键的捕获使用 window 对象的子对象 event 的 keycode 属性
以下代码仅供参考:
<%@ Language=VBScript %>
<% ' By Chen Kang
' Any Problem please email to
' chenkang@chenkang.com
' VI 6.0 Scripting Object Model Enabled %>
<!--#include file="_ScriptLibrary/pm.ASP"-->
<% if StartPageProcessing() Then Response.End() %>
<FORM name=thisForm METHOD=post>
<HTML>
<HEAD>
<META name=VI60_DTCScriptingPlatform content="Client (IE 4.0 DHTML)">
<META name=VI60_defaultClientScript content=VBScript>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
<SCRIPT ID=clientEventHandlersVBS LANGUAGE=vbscript>
<!--
Sub btnOK_onclick()
dim rtnValue
set rtnValue = LOGOn.execute.CheckPasswd(thisForm.txtUserID.value,thisForm.txtPasswd.value)
select case rtnValue.return_value
case 0
'密码正确,转其他程序
'Blahlah
case 1
msgbox("登录号错误,请重新输入!")
'set highlight
set highLight = thisForm.txtUserID.createTextRange
highLight.select
'set focus
thisForm.txtUserID.focus
case 2
msgbox("密码错误,请重新输入!")
set highLight = thisForm.txtPasswd.createTextRange
highLight.select
thisForm.txtPasswd.focus
case 3
msgbox("该用户已在别的工作站登录,请重新输入!")
set highLight = thisForm.txtPasswd.createTextRange
highLight.select
thisForm.txtPasswd.focus
end select
End Sub
Sub txtUserID_onKeyup()
'如果是回车键或下箭头
if window.event.keyCode=13 or window.event.keyCode=40 then
set highLight = thisForm.txtPasswd.createTextRange
highLight.sel