CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Java >  Web 开发

jsp页面初始化光标定位问题

楼主easyrun(深藏Blue)2005-08-26 10:10:00 在 Java / Web 开发 提问

我需要将页面初始化光标要定位在队列配置ID文本框,但是现在报错,  
  错误代码:由于该控件不可见、未启用、或其类型不允许,因此无法将焦点移向它。  
  源代码如下:  
  <%@   page   contentType="text/html;   charset=GBK"   %>  
  <%@   taglib   uri="/WEB-INF/struts-logic.tld"   prefix="logic"   %>  
  <%@   taglib   uri="/WEB-INF/struts-bean.tld"   prefix="bean"   %>  
  <%@   taglib   uri="/WEB-INF/struts-html.tld"   prefix="html"   %>  
   
  <html:html>  
  <html:base/>  
  <head>  
  <title>队列管理器配置</title>  
  <link   href="../skin_default/style_default_e.css"   rel="stylesheet"   type="text/css">  
  </head>  
   
  <body>  
  <html:form   action="/qmQuery.do">  
  <bean:define   id="pageURL"   type="String"   name="qmForm"   property="pageURL"/>  
  <bean:define   id="row"   type="Integer"   name="qmForm"   property="rowCount"/>  
  <html:hidden   name="qmForm"   property="taskId"/>  
  <html:hidden   name="qmForm"   property="mqidone"/>  
  <html:hidden   name="qmForm"   property="pageLines"   value="20"/>  
  <table   width="100%"     border="0"   cellpadding="0"   cellspacing="1"   class="Search_box">  
                <tr>  
                    <td   class="Search_bg"   id="searcharea"><TABLE   border=0   align="left"   cellPadding=0   cellSpacing=6   class="Search">  
                          <TR>  
                              <TD   nowrap   class="Search_item">队列管理器ID:</TD>  
                              <TD   nowrap   class="Search_content"><html:text   property="mqid"   name="qmForm"     styleClass="Search_input"   tabindex="1"   onkeydown="nextFocus(this.form)"   /></TD>  
                  <TD   nowrap   class="Search_item">名称:</TD>  
                              <TD   nowrap   class="Search_content"><html:text   property="mqname"   name="qmForm"   styleClass="Search_input"   tabindex="2"   onkeydown="nextFocus(this.form)"   /></TD>  
              </TR>  
                          <TR>  
                              <TD   nowrap   class="Search_item">连接串:</TD>  
                              <TD   colspan="3"   nowrap   class="Search_content"><html:text   property="mqurl"   name="qmForm"   styleClass="Search_input"   size="50"   tabindex="3"   onkeydown="nextFocus(this.form)"   onkeypress="stop(this.form)"   />  
                  </TD>  
                          </TR>  
                                <TD   colspan="4"   class="Search_button_bg">  
                                    <input   type="button"   value="查     询"     class="Search_button"   onclick="queryPage(this.form)"   tabindex="4">&nbsp;  
                                    <input   type="button"   value="重     置"   class="Search_button"   onclick="resetText(this.form)"></TD>  
                    </td></table>  
                  <tr>  
  </table>  
   
  <script   language="JavaScript"   type="text/javascript">  
      <!--  
          document.forms["qmForm"].elements["mqid"].focus()  
      //-->  
  </script>  
  </html:form>  
  </body>  
   
  </html:html>  
   
  我还是过不用下面那段js,而是<html:form   action="/qmQuery.do"   focus="mqid">但是出现同样的错误。请如果知道原因了,请给点提示。 问题点数:20、回复次数:10Top

1 楼easyrun(深藏Blue)回复于 2005-08-26 16:00:21 得分 0

等Top

2 楼samplerain(samplerain)回复于 2005-08-26 16:40:19 得分 9

在html:form外面写写看  
   
  直接document.all.myid.focus()就行了  
   
  try~Top

3 楼easyrun(深藏Blue)回复于 2005-08-26 18:23:21 得分 0

还是不可以,这个方法我最早的时候用过的,提示找不到document.all.myid这个对象.  
  这个问题困扰我很久了,这个功能是可有可无.但是这个问题不能解决到我自己心里不痛快  
  !Top

4 楼samplerain(samplerain)回复于 2005-08-26 19:45:18 得分 1

把html:base去掉Top

5 楼easyrun(深藏Blue)回复于 2005-08-29 09:39:50 得分 0

html:base是不可以去了,使用了这个标签,该页面引用同一个应用其他页面时,只需要给出相对于当前网页的相对URL即可。这个标签一去整个页面的东西都乱了.Top

6 楼easyrun(深藏Blue)回复于 2005-08-31 12:31:47 得分 0

真的没人找的到合适的办法吗,如果下午5点还没有我就结帖了!Top

7 楼zeq258(周二强)回复于 2005-08-31 12:39:53 得分 5

要将光标定位,  
  很简单呀,  
   
  <html:text   ......onfocus="true"     />  
   
  在需要定位的标签设置onfocus就可以了!Top

8 楼easyrun(深藏Blue)回复于 2005-08-31 12:53:48 得分 0

这个方法也是用过的,在body那也试过onload,在form那也试过focus,都是不可以的!就是因为这些常规的方法都不行我才会来问得!Top

9 楼emersonwu()回复于 2005-08-31 15:45:51 得分 5

<script   language="JavaScript"   type="text/JavaScript">  
  <!--  
   
          function   init()   {      
                  document.forms["qmForm"].elements["mqid"].focus()  
          }          
           
  //-->  
  <body   onLoad="javascript:init()"   >Top

10 楼easyrun(深藏Blue)回复于 2005-08-31 16:48:45 得分 0

谢谢大家,虽然问题没有解决!楼上的也不可以Top

相关问题

  • 如何一次性的初始化所有的JSP页面?
  • 如何初始化和结束JSP页面
  • 页面初始化问题。
  • 请问如何初始化页面?
  • 各位,我现在想要在struts的ActionForm中获得传递过来的参数以实现JSP页面的初始化。
  • 各位,我现在想要在struts的ActionForm中获得传递过来的参数以实现JSP页面的初始化。
  • 在页面初始化时判断DropdownList是否为空?急
  • 在struts中,如何在页面初始化是,不让struts自动初始化其中的form?
  • textArea 初始化时如何移动光标到顶部?100分送
  • jsp初始化错误是怎么回事

关键词

得分解答快速导航

  • 帖主:easyrun
  • samplerain
  • samplerain
  • zeq258
  • emersonwu

相关链接

  • CSDN Java频道
  • Java类图书
  • Java类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo