<html>
<head>
<meta   http-equiv="Content-Type"   content="text/html;   charset=utf-8"   />
<title> </title>
</head>
<body><form   name=form1>  
<input   name="key"   id="key"   value="">  
<input   name="text2">  
</form>  
</body>
<SCRIPT   language=javascript>
document.getElementById('key').focus();
alert(titab);
</script>
</html>注意页面加载顺序  ,放到body后面也可以

解决方案 »

  1.   

    document.getElementById('key').focus(); 
    <input   name="key"   id="key"   value="">   当执行document.getElementById('key').focus()时
    <input   name="key"   id="key"   value="">  还没有被加载到document对象里
      

  2.   

    又出现了另一个问题 =.=当用程序window.location.href='"&request.servervariables("http_referer")&"'刷新时,光标的位置正常显示在指定位置当用鼠标点中页面后,光标即消失,这个还好,但之后不管用F5或右键刷新,光标均无法出现在指定的位置,不再显示