谢谢楼上两位。
都试过了,不好使啊。
把代码贴上来,大家看看有何高招。
<SCRIPT TYPE="text/JavaScript">
function fnOnLoad()
{
document.form1.btndisabled.disabled=true; //怎样让确定两个字显示成红色???
return;
}
function cfnKeyDown(strPreFocus,strNextFocus)
{
//37is←
//38is↑
//39is→
//40is↓
if (this.event.keyCode == 37 || this.event.keyCode == 38){
if (strPreFocus != ""){
if (document.form1.elements[strPreFocus].name=="KEY_MISENO"){
document.form1.elements[strPreFocus].select(); //怎样实现输入的内容被选中???
}else{
document.form1.elements[strPreFocus].focus();
}
}
}
if (this.event.keyCode == 39 || this.event.keyCode == 40){
if (strNextFocus != ""){
if (document.form1.elements[strNextFocus].name=="KEY_MISENO"){
document.form1.elements[strNextFocus].select(); //怎样实现输入的内容被选中???
}else{
document.form1.elements[strNextFocus].focus();
}
}
}
return;
}
</script>
</HEAD>
<base target="_self">
<BODY BGCOLOR="#529488" onLoad="fnOnLoad();">
<FORM method="post" name="form1" onSubmit="return (false);" >
<INPUT name="KEY_MISENO" type="text" size="6" maxlength="6" value="" onKeyDown="cfnKeyDown('','btnCommit')">
<br>
<INPUT TYPE="button" NAME="btnCommit" VALUE="確定" onKeyDown="cfnKeyDown('KEY_MISENO','btncancle');">
<br>
<INPUT TYPE="button" NAME="btncancle" VALUE="取消" onKeyDown="cfnKeyDown('btnCommit','');">
<br>
<INPUT TYPE="button" NAME="btndisabled" VALUE="不可用" style="color:red">
</FORM>
</BODY>
</HTML>