yaojxing 2013-01-27
代码如下:
<script type = "text/javascript"> function isNumeric(keyCode) { return ((keyCode >= 48 && keyCode <= 57) || keyCode == 8) } </script> <script type = "text/javascript"> function isAlpha(keyCode) { return ((keyCode >= 65 && keyCode <= 90) || keyCode == 8) } </script> <script type = "text/javascript"> function isAlphaOrNumeric(keyCode) { return ((keyCode >= 48 && keyCode <= 57) || (keyCode >= 65 && keyCode <= 90) || keyCode == 8) } </script>
代码如下:
<asp:TextBox ID="TextBox1" runat="server" onkeydown = "return isAlphaOrNumeric(event.keyCode);" onpaste = "return false;"></asp:TextBox>
alert("不准你使用ALT+方向键前进或后退网页!因为 Alt+ 方向键弹出警告框时,按住 Alt 键不放,用鼠标点掉警告框,这种屏蔽方法就失效了。有哪位高手有真正屏蔽 Alt 键的方法,请告知。