ASP申请单动态添加实现方法及代码

作者:佚名 来源:中国IT实验室 时间:2008-11-04 11:09:00 



一个申请单可以包含N个项目,添加申请单时就需要动态加入代码了。

动态Table表格

<table border="0" width="98%" id="tabzx" name="tabzx" align="center"
class="table_list">
<tr>
<td class="th_list" width="10%">
A列
</td>
<td class="th_list" width="10%" align="center">
B列 </td>
<td class="th_list" width="10%" align="center">
C列
</td>
<td class="th_list" width="5%" align="center">
D列
</td>
<td class="th_list" width="5%" align="center">
E列
</td>
<td class="th_list" width="5%" align="center">
F列
</td><%--
<td class="th_list" width="7%" align="center">
G列
</td>

--%><td class="th_list" width="13%">
[
<a href="javascript:doSelect(450,400,'formEdit.supplyId')"><font
color="FF0000">选择设备</font> </a>]
</td>
</tr>
</table>



JS代码如下(根据条件弹出设备列表,然后选择已有设备)

function doSelect(Width,Height,ctrlobj){

var k;
var s = new Object();
k=showModalDialog("/Applications_add_addsearch.jsp",s,"dialogWidth:320px;status:no;scroll:no;dialogHeight:280px");
if (k!=null)
{
var url = "/applicationsAction.do?method=insertAddSeach&stId="+k[0]+"&sbId="+k[1]+"&ggId="+k[2];
window.open(url,'newwindow', 'height=600, width=800, toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no');
}

}

=========================

根据选择动态添加数据代码



<script language="vbscript">
dim lcountmx
lcountmx = 0
function badd(stid,stName,vcid,vcName,ggid,ggName,dwei,sliang,djia)
lcountmx=lcountmx+1
dim oRow,oCell,ii
set oRow=tabzx.insertRow
orow.id="trzx" & lcountmx
set ocell=orow.insertcell
dim sss
sss="<input type=hidden name=cgdjmx"& lcountmx & " value="""">"
sss=sss&"<input type=hidden name=stid"& lcountmx & " value=" & stid & ">"
sss=sss&"<input type=hidden name=stName"& lcountmx & " value=" & stName & ">"
sss=sss&"<input type=hidden name=vcid"& lcountmx & " value=" & vcid & ">"
sss=sss&"<input type=hidden name=ggid"& lcountmx & " value=" & ggid & ">"
sss=sss&stName
ocell.innerhtml= sss
ocell.classname="ListCellRow"


set ocell=orow.insertcell
ocell.classname="ListCellRow"
ocell.align="center"
ocell.width="60"
ocell.innerhtml="<input type=hidden name=vcName" & lcountmx & " value=" & vcName & ">"& vcName

set ocell=orow.insertcell
ocell.classname="ListCellRow"
ocell.align="center"
ocell.width="60"
ocell.innerhtml="<input type=hidden name=ggName" & lcountmx & " value=" & ggName & ">"& ggName

set ocell=orow.insertcell
ocell.classname="ListCellRow"
ocell.align="center"
ocell.width="60"
ocell.innerhtml="<input type=text size=10 name=thao" & lcountmx & " value=''>"

set ocell=orow.insertcell
ocell.classname="ListCellRow"
ocell.align="center"
ocell.width="60"
ocell.innerhtml="<input type=hidden name=dwei" & lcountmx & " value=" & dwei & ">"& dwei

set ocell=orow.insertcell
ocell.classname="ListCellRow"
ocell.align="center"
ocell.width="60"
ocell.innerhtml="<input type=text size=3 name=sliang" & lcountmx & " onchange='changeFun(" & lcountmx & ")' value=''>"
<%--
set ocell=orow.insertcell
ocell.classname="ListCellRow"
ocell.align="center"
ocell.width="60"
ocell.innerhtml="<input type=text size=3 name=djia" & lcountmx & " onchange='changeFun1(" & lcountmx & ")' value=''>"
--%>


set ocell=orow.insertcell
ocell.classname="ListCellRow"
ocell.innerhtml="<input type='button' value='删除' onClick='vbscript:bdel(" & lcountmx & ")' id=button7 name=button7>"
ocell.align="center"

document.applicationsForm.ypsl.value = lcountmx
end function

function bdel(l)
tabzx.deleteRow document.getElementById("trzx" & l).rowindex
end function

function changeFun(obj1)
change obj1
end function

function changeFun1(obj1)
change1 obj1
end function
</script>



====================

标签:
0
投稿

猜你喜欢

  • 细节设计之美:扩大可操作区域

    2009-08-01 11:32:00
  • 对抗MySQL数据库解密高手

    2008-12-25 13:14:00
  • [ASP]利用 xmlhttp 分块上传文件

    2008-07-04 14:14:00
  • 不同情况下修复Access数据库的实用方法

    2008-11-28 16:18:00
  • 什么设计师应该学习编写代码[译]

    2009-07-08 14:58:00
  • asp如何做一个随机密码产生器?

    2010-07-12 18:57:00
  • 浅说相册图片详情页面中大图的浏览方式

    2009-02-01 18:34:00
  • 绿色下划线的简洁CSS导航代码

    2007-09-17 12:51:00
  • 判断浏览器是否接受 Cookie

    2009-07-28 17:52:00
  • Http头 Range、Content-Range

    2010-06-25 19:19:00
  • 自己重新写了一个JavaScript的对象克隆函数

    2008-08-03 16:47:00
  • asp 根据IP地址自动判断转向分站的代码

    2011-04-14 10:51:00
  • Safari参考样式库之webkit

    2009-07-26 09:50:00
  • asp如何建立和删除文件夹?

    2009-11-26 20:34:00
  • 监测站点使用多少session和application的asp程序

    2007-09-12 19:40:00
  • asp textarea 多行数组分割处理方法

    2011-03-03 10:55:00
  • 慢慢的网页

    2009-11-12 12:53:00
  • 如何将服务器端变量转换为客户端的变量?

    2009-12-03 19:54:00
  • 制作主页的独门功夫五十招

    2010-09-05 21:15:00
  • asp三天学好ADO对象之第三天

    2008-10-09 12:53:00
  • asp之家 网络编程 m.aspxhome.com