日期:2014-05-17  浏览次数:21026 次

键盘事件怎么无效呢?
HTML code

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<html>
<head>
<script language="vbscript">                                               '这里不起作用。
Function aaa()
msgbox "bbb"
End Function
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>
</title>
</head>
<body>
<form name="form1" method="post" action="">
  <input name="shenfenzheng1" type="text" id="shenfenzheng1">
  <input type="submit" name="Submit" value="检测" onKeyDown="aaa()">        '这里不起作用。
</form>
</body>
</html>



------解决方案--------------------
HTML code
<script language="VBscript" for="shenfenzheng1" event="onKeyDown">
    msgbox("这是方法一。") 'event=事件
</script>
<form name="form1" method="post" action="">
    <input name="shenfenzheng1" type="text" id="shenfenzheng1" />
</form>

<H1 language="VBscript" onclick="msgbox '点我就对了!!'" >方法二</H1>

<script language="VBscript">
    SUB andy_onclick '以卷标的ID(andy)加上事件的名称(onclick)当作子程序的名称
    msgbox "点我就对了!!"
    END SUB
</script>
    <H1 id="andy">方法三</H1>

<script language="VBscript">
    SUB beclick '请区别一下Function
    msgbox "方法四!!"
    END SUB
</script>
<input type="button" value="方法四" onclick="beclick()" />
说明:以上效果只能在IE下查看,不推荐使用!