ASP 文本框焦点问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 19:24:05
<html>
<body bgcolor="#7388c1" text="Black">
<center>
<form method="get" action="" name="form" id="form">
请输入谈话内容:<input type="text" name="ChatMsg" id="ChatMsg" size="53">
<input type="submit" value="发送">
<input type="reset" value="清除">
</form>
</center>
</body>
</html>

'我想按下回车按钮后,文本框获得焦点.
'需要怎样修改或加哪些代码呢?
'本人只会看VBscript,请问用VBscript该怎样做?

楼主呀,现在谁有vbs,都有js啦,不会可以学呀,
VBS只能在IE用,现在不流行了。
我给你整断js的。兼容所有浏览器!!
把这段代码加你HTML后面

<script type="text/javascript">
document.onkeydown=function() {
if(event.keyCode==13) {
document.getElementById("ChatMsg").focus();
}
}
</script>