大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> ASP专区 -> 例子源码:纯DHTML编写的可编辑增删的表格

例子源码:纯DHTML编写的可编辑增删的表格

时间: 2021-07-31 作者:daque

<html><head><meta content="text/html; charset=utf8" 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=0var currentline=-1function 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("date")[line].classname="tabledatahit";document.ecform("diagnosis")[line].classname="tabledatahit";document.ecform("medication")[line].classname="tabledatahit";if (oldline>0){ document.all.tdt[oldline].classname="tabledata"; document.ecform("date")[oldline].classname="tabledata"; document.ecform("diagnosis")[oldline].classname="tabledata"; document.ecform("medication")[oldline].classname="tabledata";}currentline=ln }}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.diagnosis[i].value.length>0 || document.ecform.medication[i].value.length>0 || document.ecform.date[i].value.length>0) if (!confirm("are you sure you want to delete this record?"))returnpllist.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=10 maxlength=10 name=date ln="+allcount+" class=tabledata onkeyup='modifiedit()'>" c3=newrow.insertcell(2); c3.ln=allcount; c3.innerhtml="<input type=text size=25 maxlength=50 name=diagnosis ln="+allcount+" class=tabledata onkeyup='modifiedit()'>" c4=newrow.insertcell(3); c4.ln=allcount; c4.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=10><font color=white>x <input name=plid type=hidden><input name=edit type=hidden></font></th><th width="10%"><input name=date type=hidden><font color=white>date </font> <th width="30%"><input name=diagnosis type=hidden><font color=white>diagnosis </font> <th width="60%"><input name=medication type=hidden><font color=white>medication </font></tr><tr bgcolor=#e0e0e0 class=tabledata id=tdt onclick=lighton() ln="1"> <td class=schedulebuttonvisible onclick=delit() onmouseout=mouseout() onmouseover=mouseover() ln="1"><font size=2><input name=plid type=hidden value=54 ln="1"><input name=edit type=hidden value=0></font></td><td ln="1"><input class=tabledata maxlength=10 name=date onkeyup=modifiedit(this) size=10 ln="1"></td><td ln="1"><input class=tabledata maxlength=50 name=diagnosis onkeyup=modifiedit(this) size=25 value="what do you think of it?" ln="1"></td><td ln="1"><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"><font size=2><input name=plid type=hidden value=55 ln="2"><input name=edit type=hidden value=0></font></td><td ln="2"><input class=tabledata maxlength=10 name=date onkeyup=modifiedit(this) size=10 value=01/01/1999 ln="2"></td><td ln="2"><input class=tabledata maxlength=50 name=diagnosis onkeyup=modifiedit(this) size=25 value="it`s a test" ln="2"></td><td ln="2"><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"><font size=2><input name=plid type=hidden value=56 ln="3"><input name=edit type=hidden value=0></font></td><td ln="3"><input class=tabledata maxlength=10 name=date onkeyup=modifiedit(this) size=10 value=02/01/2000 ln="3"></td><td ln="3"><input class=tabledata maxlength=50 name=diagnosis onkeyup=modifiedit(this) size=25 value="another test" ln="3"></td><td ln="3"><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></tbody></table></div></form></body></html>

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.