adddeltable.js
来自「php绿色服务器,让大家试用greenamp」· JavaScript 代码 · 共 148 行
JS
148 行
//文件 addDelTable.js 代码如下
var modified=0
var currentLine=-1
var line=-1
function delIt(tableID) {
var PLList=document.getElementById(tableID);
line=parseInt(event.srcElement.ln,10)
if(tableID=="commandTable"){
if (line>0){
for (i=1;i<PLList.rows.length;i++){
if (cT[i].ln==line){
if (( document.ecform.cMa[i].value.length>0 )|( document.ecform.cMb[i].value.length>0 )|( document.ecform.cMc[i].value.length>0 )){
if (!confirm("Are you sure you want to delete this record?")){
return
}
}
PLList.deleteRow(i)
}
}
}
}
if(tableID=="technicianTable"){
if (line>0){
for (i=1;i<PLList.rows.length;i++){
if (tT[i].ln==line){
if ( ( document.ecform.tMa[i].value.length>0 )|( document.ecform.tMb[i].value.length>0 )|( document.ecform.tMc[i].value.length>0 )){
if (!confirm("Are you sure you want to delete this record?")){
return
}
}
PLList.deleteRow(i)
}
}
}
}
if(tableID=="protectorTable"){
if (line>0){
for (i=1;i<PLList.rows.length;i++){
if (pT[i].ln==line){
if (( document.ecform.pMa[i].value.length>0 )|( document.ecform.pMb[i].value.length>0 )|( document.ecform.pMc[i].value.length>0 )){
if (!confirm("Are you sure you want to delete this record?")){
return
}
}
PLList.deleteRow(i)
}
}
}
}
if(tableID=="witnessTable"){
if (line>0){
for (i=1;i<PLList.rows.length;i++){
if (wT[i].ln==line){
if (( document.ecform.wMa[i].value.length>0 )|( document.ecform.wMb[i].value.length>0 )|( document.ecform.wMc[i].value.length>0 )){
if (!confirm("Are you sure you want to delete this record?")){
return
}
}
PLList.deleteRow(i)
}
}
}
}
}
function newHospitalVisit(tableID)
{
var PLList=document.getElementById(tableID);
newRow=PLList.insertRow(PLList.rows.length);
var medicationA="";
var medicationB="";
var medicationC="";
if (tableID=="commandTable"){
newRow.id="cT";
medicationA="cMa";
medicationB="cMb";
medicationC="cMc";
allCount=countA;
countA++;
}
if(tableID=="technicianTable"){
newRow.id="tT";
medicationA="tMa";
medicationB="tMb";
medicationC="tMc";
allCount=countB;
countB++;
}
if(tableID=="protectorTable"){
newRow.id="pT";
medicationA="pMa";
medicationB="pMb";
medicationC="pMc";
allCount=countC;
countC++;
}
if(tableID=="witnessTable"){
newRow.id="wT";
medicationA="wMa";
medicationB="wMb";
medicationC="wMc";
allCount=countD;
countD++;
}
//alert(newRow.id);
//newRow.id="tdt";
newRow.ln=allCount;
newRow.bgColor="";
newRow.className="form_content";
//newRow.onclick=lightOn;
c1=newRow.insertCell(0);
c1.ln=allCount;
c1.className="form_label";
//c1.onclick=delIt();
//c1.onmouseover=mouseOver;
//c1.onmouseout=mouseOut;
c1.innerHTML=tableID;
c2=newRow.insertCell(1);
c2.ln=allCount;
c2.className="form_content";
c2.innerHTML="<input type=text class=longfield id="+medicationA+" ln="+allCount+" class=tableData onkeyup='modifiedIt()'>" ;
c3=newRow.insertCell(2);
c3.ln=allCount;
c3.className="form_content";
c3.innerHTML="<input type=text class=longfield id="+medicationB+" ln="+allCount+" class=tableData onkeyup='modifiedIt()'>" ;
c4=newRow.insertCell(3);
c4.ln=allCount;
c4.className="form_content";
c4.innerHTML="<input type=text class=longfield id="+medicationC+" ln="+allCount+" class=tableData onkeyup='modifiedIt()'>"
c5=newRow.insertCell(4);
c5.ln=allCount;
c5.className="form_label";
c5.id="delItem";
c5.innerHTML="<input type=button value='删除' width=18 height=18 ln="+allCount+" onClick=delIt('"+tableID+"')>" ;
allCount++
}
function mouseOver()
{
Event.srcElement.className="delMouseOver"
}
function mouseOut()
{
Event.srcElement.className="scheduleButtonVisible"
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?