CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Java >  Web 开发

添加、删除记录和颠倒顺序,帮帮忙!

楼主fishone(fishone)2002-04-10 14:21:41 在 Java / Web 开发 提问

我在dreamweaver用几个textfield组成一个选择框,又添加了“添加”“删除”“上移”“下移”几个按钮,要用jsp写个程序,使按下“添加”按钮时,自动增加一个textfield,按“上移”时,所选的textfield内容自动上移一个位置。  
  请大侠说的详细一些,谢谢!!!  
  问题点数:50、回复次数:3Top

1 楼weidegong(weidegong)回复于 2002-04-10 17:27:44 得分 0

<HTML>  
  <HEAD>  
  <META   content="text/html;   charset=gb2312"   http-equiv=Content-Type>  
  <STYLE   type=text/css>BODY   {  
  BACKGROUND:   white;   COLOR:   black;   FONT-FAMILY:   verdana,arial,helvetica;   FONT-SIZE:   12px  
  }  
  .tableData   {  
  BACKGROUND:   white;   BORDER-BOTTOM:   white   1px   dashed;   BORDER-LEFT:   white   1px   dashed;   BORDER-RIGHT:   white   1px   dashed;   BORDER-TOP:   white   1px   dashed;   COLOR:   black;   CURSOR:   hand;   FONT-FAMILY:   verdana,arial,helvetica;   FONT-SIZE:   12px  
  }  
  .tableDataSel   {  
  BACKGROUND:   #6090d0;   BORDER-BOTTOM:   #6090d0   1px   dashed;   BORDER-LEFT:   #6090d0   1px   dashed;   BORDER-RIGHT:   #6090d0   1px   dashed;   BORDER-TOP:   #6090d0   1px   dashed;   COLOR:   white;   CURSOR:   hand;   FONT-FAMILY:   verdana,arial,helvetica;   FONT-SIZE:   12px  
  }  
  .tableDataHit   {  
  BACKGROUND:   #d0e0ff;   BORDER-BOTTOM:   #d0e0ff   1px   dashed;   BORDER-LEFT:   #d0e0ff   1px   dashed;   BORDER-RIGHT:   #d0e0ff   1px   dashed;   BORDER-TOP:   #d0e0ff   1px   dashed;   COLOR:   black;   CURSOR:   hand;   FONT-FAMILY:   verdana,arial,helvetica;   FONT-SIZE:   12px  
  }  
  .tableDataOver   {  
  BACKGROUND:   #d0e0ff;   BORDER-BOTTOM:   #d0e0ff   1px   dashed;   BORDER-LEFT:   #d0e0ff   1px   dashed;   BORDER-RIGHT:   #d0e0ff   1px   dashed;   BORDER-TOP:   #d0e0ff   1px   dashed;   COLOR:   black;   CURSOR:   hand;   FONT-FAMILY:   verdana,arial,helvetica;   FONT-SIZE:   12px  
  }  
  .controlPanel   {  
  BACKGROUND:   silver;   COLOR:   black;   CURSOR:   hand;   FONT-FAMILY:   verdana,arial,helvetica;   FONT-SIZE:   14px  
  }  
  .controlPanelMouseOver   {  
  BACKGROUND:   #d0e0ff;   COLOR:   black;   CURSOR:   hand;   FONT-FAMILY:   verdana,arial,helvetica;   FONT-SIZE:   14px  
  }  
  .delMouseOver   {  
  BACKGROUND:   #d0e0ff;   COLOR:   black;   CURSOR:   hand;   FONT-FAMILY:   verdana,arial,helvetica;   FONT-SIZE:   14px  
  }  
  .scheduleButtonVisible   {  
  BACKGROUND:   silver;   BORDER-BOTTOM:   gray   1px   dashed;   BORDER-LEFT:   white   1px   dashed;   BORDER-RIGHT:   gray   1px   dashed;   BORDER-TOP:   white   1px   dashed;   COLOR:   black;   CURSOR:   hand;   FONT-FAMILY:   webdings;   FONT-SIZE:   12px  
  }  
  </STYLE>  
  <SCRIPT   language=javascript>  
  var   modified=0  
  var   currentLine=-1  
  var   line=-1  
  function   lightOn(ln)  
  {  
  if   (ln==null)  
      ln=parseInt(event.srcElement.ln,10)  
  for   (i=1;i<PLList.rows.length;i++)  
      if   (tdt[i].ln==ln)  
        line=i  
  cln=currentLine  
  oldLine=-1  
  for   (i=1;i<PLList.rows.length;i++)  
      if   (tdt[i].ln==cln)  
        oldLine=i  
  if   (line==oldLine)  
      return  
  //if   td   <0   then   only   clear   all   title  
  if   (line>0)  
  {  
      document.all.tdt[line].className="tableDataHit";  
      document.ecform("medication")[line].className="tableDataHit";  
      if   (oldLine>0)  
      {  
        document.all.tdt[oldLine].className="tableData";  
        document.ecform("medication")[oldLine].className="tableData";  
      }  
      currentLine=ln  
  }  
  }  
   
  function   move(direc){  
  //向下移动direc行,并将移动到的行高亮度显示  
   
  if(line+direc<1   ||   (line+direc)>document.all.tdt.length-1)   return;  
  var   temp=document.ecform.medication[line].value;  
  document.ecform.medication[line].value=document.ecform.medication[line+direc].value;  
  document.ecform.medication[line+direc].value=temp  
   
  line+=direc;  
  lightOn(line);  
  }  
  function   delIt()  
  {  
  line=parseInt(event.srcElement.ln,10)  
       
  if   (line>0)  
      for   (i=1;i<PLList.rows.length;i++)  
        if   (tdt[i].ln==line)  
        {  
          if   (   document.ecform.medication[i].value.length>0   )  
            if   (!confirm("Are   you   sure   you   want   to   delete   this   record?"))  
              return  
          PLList.deleteRow(i)  
        }  
  }  
  function   modifiedIt(field)  
  {  
  //   field.value=checkText(field.value);  
  modified=1  
  line=parseInt(event.srcElement.ln,10)  
       
  if   (line>0)  
        for   (i=1;i<PLList.rows.length;i++)  
          if   (tdt[i].ln==line)  
            document.ecform.edit[i].value=1  
  }  
  function   newHospitalVisit()  
  {  
  newRow=PLList.insertRow(PLList.rows.length);  
  newRow.id="tdt";  
  newRow.ln=allCount;  
  newRow.bgColor="#e0e0e0";  
  newRow.className="tableData";  
  newRow.onclick=lightOn;  
   
  c1=newRow.insertCell(0);  
  c1.id="delItem";  
  c1.ln=allCount;  
  c1.className="scheduleButtonVisible";  
  c1.onclick=delIt;  
  c1.onmouseover=mouseOver;  
      c1.onmouseout=mouseOut;  
  c1.innerHTML="<input   type=hidden   name=PLID   value=0><input   type='hidden'   name='edit'   value=0>";  
  c2=newRow.insertCell(1);  
  c2.ln=allCount;  
  c2.innerHTML="<input   type=text   size=58   maxlength=100   name=medication   ln="+allCount+"   class=tableData   onkeyup='modifiedIt()'>"  
  allCount++  
  }  
  function   mouseOver()  
  {  
  event.srcElement.className="delMouseOver"  
  }  
  function   mouseOut()  
  {  
  event.srcElement.className="scheduleButtonVisible"  
  }  
  </SCRIPT>  
  </HEAD>  
  <BODY   bgColor=white>  
  <FORM   method=post   name=ecform>  
      <META   content="MSHTML   5.00.2920.0"   name=GENERATOR>  
      <DIV   id=div1    
  style="LEFT:   0px;   POSITION:   absolute;   TOP:   0px;   VISIBILITY:   visible;   WIDTH:   658px">    
          <TABLE   bgColor=silver   border=2   borderColorDark=gray   borderColorLight=silver    
  cellPadding=2   cellSpacing=1   cols=1   id=PLList   rules=rows   width="100%">  
              <TBODY>    
              <TR   bgColor=#0a6846   id=tdt>    
                  <TH   width=80><FONT   color=white>删除    
                      <INPUT   name=PLID   type=hidden>  
                      <INPUT    
              name=edit   type=hidden>  
                      </FONT></TH>  
                  <TH   width="559">    
                      <INPUT   name=medication   type=hidden>  
                      <FONT    
              color=white>变化表格   </font>    
              </TR>  
              <TR   bgColor=#e0e0e0   class=tableData   id=tdt   onclick=lightOn()   ln="1">    
                  <TD   class=scheduleButtonVisible   onclick=delIt()   onmouseout=mouseOut()    
          onmouseover=mouseOver()   ln="1"   width="80"><FONT   size=2>    
                      <INPUT   name=PLID   type=hidden    
              value=54   ln="1">  
                      <INPUT   name=edit   type=hidden   value=0>  
                      </FONT></TD>  
                  <TD   ln="1"   width="559">    
                      <INPUT   class=tableData   maxLength=100   name=medication    
              onkeyup=modifiedIt(this)   size=58   value="like   it?"   ln="1">  
                  </TD>  
              </TR>  
              <TR   bgColor=#e0e0e0   class=tableData   id=tdt   onclick=lightOn()   ln="2">    
                  <TD   class=scheduleButtonVisible   onclick=delIt()   onmouseout=mouseOut()    
          onmouseover=mouseOver()   ln="2"   width="80"><FONT   size=2>    
                      <INPUT   name=PLID   type=hidden    
              value=55   ln="2">  
                      <INPUT   name=edit   type=hidden   value=0>  
                      </FONT></TD>  
                  <TD   ln="2"   width="559">    
                      <INPUT   class=tableData   maxLength=100   name=medication    
              onkeyup=modifiedIt(this)   size=58   value="how   about   it?"   ln="2">  
                  </TD>  
              </TR>  
              <TR   bgColor=#e0e0e0   class=tableData   id=tdt   onclick=lightOn()   ln="3">    
                  <TD   class=scheduleButtonVisible   onclick=delIt()   onmouseout=mouseOut()    
          onmouseover=mouseOver()   ln="3"   width="80"><FONT   size=2>    
                      <INPUT   name=PLID   type=hidden    
              value=56   ln="3">  
                      <INPUT   name=edit   type=hidden   value=0>  
                      </FONT></TD>  
                  <TD   ln="3"   width="559">    
                      <INPUT   class=tableData   maxLength=100   name=medication    
              onkeyup=modifiedIt(this)   size=58   ln="3">  
                  </TD>  
              </TR>  
              </TBODY>    
          </TABLE>  
          <SCRIPT>  
  allCount=4  
  </SCRIPT>  
           
   
          <TABLE   align=center   border=1   borderColorDark=white   borderColorLight=gray    
  cellPadding=1   cellSpacing=1   class=controlPanel   cols=4   rules=all   width="100%"    
  nowrap>  
              <TBODY>    
              <TR>    
                  <TD   align=middle   class=controlPanel   onclick=newHospitalVisit()    
          onmouseout="this.className='controlPanel'"    
          onmouseover="this.className='controlPanelMouseOver'"><FONT   size=2>Add   a   New    
                      Record,   click   here</FONT></TD>  
              </TR>  
              <TR>    
                  <TD   align=middle   class=controlPanel   onclick=move(-1)    
          onmouseout="this.className='controlPanel'"    
          onmouseover="this.className='controlPanelMouseOver'"><FONT   size=2>Moveup   current      
                      Record,   click   here</FONT></TD>  
              </TR>  
              <TR>    
                  <TD   align=middle   class=controlPanel   onclick=move(1)    
          onmouseout="this.className='controlPanel'"    
          onmouseover="this.className='controlPanelMouseOver'"><FONT   size=2>Movedown   current    
                      Record,   click   here</FONT></TD>  
              </TR>  
              </TBODY>    
          </TABLE>  
      </DIV>  
  </FORM>  
  </BODY>  
  </HTML>Top

2 楼weidegong(weidegong)回复于 2002-04-10 17:29:57 得分 50

大侠只是觉得分不太够  
  自己看看代码,不懂的再问我Top

3 楼fishone(fishone)回复于 2002-04-10 18:06:13 得分 0

我先试试,成功的话,以后只要是你回答我的问题,我就给你加分。Top

相关问题

  • 我的“添加/删除”不好用了!
  • 添加删除程序里的问题
  • 如何删除动态添加的列?
  • toolbar如何动态添加删除TToolButton?
  • 表格添加删除行的操作
  • 在jScrollPane上添加删除jPanel
  • 删除动态添加的控件
  • 后台添加/删除记录问题
  • adodc添加、更新、删除时出错~
  • 怎样永久的添加、删除IP

关键词

  • 删除
  • click here
  • current record

得分解答快速导航

  • 帖主:fishone
  • weidegong

相关链接

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

广告也精彩

反馈

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