当前位置: 代码迷 >> Web前端 >> 报表的操作,增加删除行(Having Bug)
  详细解决方案

报表的操作,增加删除行(Having Bug)

热度:308   发布时间:2012-11-03 10:57:44.0
表格的操作,增加删除行(Having Bug)
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<STYLE type=text/css>BODY {
BACKGROUND: white; FONT: menu; COLOR: black
}
.tableData {
BORDER-RIGHT: white 1px dashed; BORDER-TOP: white 1px dashed; FONT-SIZE: 12px; BACKGROUND: white; BORDER-LEFT: white 1px dashed; CURSOR: hand; COLOR: black; BORDER-BOTTOM: white 1px dashed; FONT-FAMILY: verdana,arial,helvetica
}
.tableDataSel {
BORDER-RIGHT: #6090d0 1px dashed; BORDER-TOP: #6090d0 1px dashed; FONT-SIZE: 12px; BACKGROUND: #6090d0; BORDER-LEFT: #6090d0 1px dashed; CURSOR: hand; COLOR: white; BORDER-BOTTOM: #6090d0 1px dashed; FONT-FAMILY: verdana,arial,helvetica
}
.tableDataHit {
BORDER-RIGHT: #d0e0ff 1px dashed; BORDER-TOP: #d0e0ff 1px dashed; FONT-SIZE: 12px; BACKGROUND: #d0e0ff; BORDER-LEFT: #d0e0ff 1px dashed; CURSOR: hand; COLOR: black; BORDER-BOTTOM: #d0e0ff 1px dashed; FONT-FAMILY: verdana,arial,helvetica
}
.tableDataOver {
BORDER-RIGHT: #d0e0ff 1px dashed; BORDER-TOP: #d0e0ff 1px dashed; FONT-SIZE: 12px; BACKGROUND: #d0e0ff; BORDER-LEFT: #d0e0ff 1px dashed; CURSOR: hand; COLOR: black; BORDER-BOTTOM: #d0e0ff 1px dashed; FONT-FAMILY: verdana,arial,helvetica
}
.controlPanel {
BACKGROUND: silver; FONT: menu; CURSOR: hand; COLOR: black
}
.controlPanelMouseOver {
BACKGROUND: #d0e0ff; FONT: menu; CURSOR: hand; COLOR: black
}
.delMouseOver {
BACKGROUND: #d0e0ff; FONT: menu; CURSOR: hand; COLOR: black
}
.scheduleButtonVisible {
BORDER-RIGHT: gray 1px dashed; BORDER-TOP: white 1px dashed; FONT-SIZE: 12px; BACKGROUND: silver; BORDER-LEFT: white 1px dashed; CURSOR: hand; COLOR: black; BORDER-BOTTOM: gray 1px dashed; FONT-FAMILY: webdings
}
</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>

<META content="MSHTML 6.00.3790.1830" name=GENERATOR></HEAD>
<BODY bgColor=white>
<FORM name=ecform method=post>
<META content="MSHTML 5.00.2920.0" name=GENERATOR>
<DIV id=div1
style="LEFT: 0px; VISIBILITY: visible; WIDTH: 658px; POSITION: absolute; TOP: 0px">
<TABLE id=PLList cellSpacing=1 cols=1 borderColorDark=gray cellPadding=2
rules=rows width="100%" bgColor=silver borderColorLight=silver border=2>
  <TBODY>
  <TR id=tdt bgColor=#0a6846>
    <TH width=80><FONT color=white>删除 <INPUT type=hidden name=PLID> <INPUT
      type=hidden name=edit> </FONT></TH>
    <TH width=559><INPUT type=hidden name=medication> <FONT color=white>变化表格
      </FONT></TR>
  <TR class=tableData id=tdt onclick=lightOn() bgColor=#e0e0e0 ln="1">
    <TD class=scheduleButtonVisible onmouseover=mouseOver() onclick=delIt()
    onmouseout=mouseOut() width=80 ln="1"><FONT size=2><INPUT type=hidden
      value=54 name=PLID ln="1"> <INPUT type=hidden value=0 name=edit>
</FONT></TD>
    <TD width=559 ln="1"><INPUT class=tableData onkeyup=modifiedIt(this)
      maxLength=100 size=58 value="like it?" name=medication ln="1"> </TD></TR>
  <TR class=tableData id=tdt onclick=lightOn() bgColor=#e0e0e0 ln="2">
    <TD class=scheduleButtonVisible onmouseover=mouseOver() onclick=delIt()
    onmouseout=mouseOut() width=80 ln="2"><FONT size=2><INPUT type=hidden
      value=55 name=PLID ln="2"> <INPUT type=hidden value=0 name=edit>
</FONT></TD>
    <TD width=559 ln="2"><INPUT class=tableData onkeyup=modifiedIt(this)
      maxLength=100 size=58 value="how about it?" name=medication ln="2"> </TD></TR>
  <TR class=tableData id=tdt onclick=lightOn() bgColor=#e0e0e0 ln="3">
    <TD class=scheduleButtonVisible onmouseover=mouseOver() onclick=delIt()
    onmouseout=mouseOut() width=80 ln="3"><FONT size=2><INPUT type=hidden
      value=56 name=PLID ln="3"> <INPUT type=hidden value=0 name=edit>
</FONT></TD>
    <TD width=559 ln="3"><INPUT class=tableData onkeyup=modifiedIt(this)
      maxLength=100 size=58 name=medication ln="3"> </TD></TR></TBODY></TABLE>
<SCRIPT>
allCount=4
</SCRIPT>

<TABLE class=controlPanel cellSpacing=1 cols=4 borderColorDark=white
cellPadding=1 rules=all width="100%" align=center borderColorLight=gray border=1
nowrap>
  <TBODY>
  <TR>
    <TD class=controlPanel onmouseover="this.className='controlPanelMouseOver'"
    onclick=newHospitalVisit() onmouseout="this.className='controlPanel'"
    align=middle><FONT face="仿宋_GB2312, 楷体_GB2312" size=2>添加一行</FONT></TD></TR>
  <TR>
    <TD class=controlPanel onmouseover="this.className='controlPanelMouseOver'"
    onclick=move(-1) onmouseout="this.className='controlPanel'"
      align=middle><FONT face="仿宋_GB2312, 楷体_GB2312" size=2>向上移动</FONT></TD></TR>
  <TR>
    <TD class=controlPanel onmouseover="this.className='controlPanelMouseOver'"
    onclick=move(1) onmouseout="this.className='controlPanel'"
      align=middle><FONT face="仿宋_GB2312, 楷体_GB2312"
  size=2>向下移动</FONT></TD></TR></TBODY></TABLE></DIV></FORM>
BODY></HTML>

  相关解决方案