asp

位置:IT落伍者 >> asp >> 浏览文章

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


发布日期:2024年05月14日
 
ASP申请单动态添加实现方法及代码
个申请单可以包含N个项目添加申请单时就需要动态加入代码了

动态Table表格

<table border= width=% id=tabzx name=tabzx align=center

class=table_list>

<tr>

<td class=th_list width=%>

A列

</td>

<td class=th_list width=% align=center>

B列 </td>

<td class=th_list width=% align=center>

C列

</td>

<td class=th_list width=% align=center>

D列

</td>

<td class=th_list width=% align=center>

E列

</td>

<td class=th_list width=% align=center>

F列

</td><%

<td class=th_list width=% align=center>

G列

</td>

%><td class=th_list width=%>

[

<a javascript:doSelect(formEditsupplyId)><font

color=FF>选择设备</font> </a>]

</td>

</tr>

</table>

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

function doSelect(WidthHeightctrlobj){

var k;

var s = new Object();

k=showModalDialog(/Applications_add_addsearchjspsdialogWidth:px;status:no;scroll:no;dialogHeight:px);

if (k!=null)

{

var url = /applicationsActiondo?method=insertAddSeach&stId=+k[]+&sbId=+k[]+&ggId=+k[];

windowopen(urlnewwindow height= width= toolbar=no menubar=no scrollbars=yes resizable=nolocation=no status=no);

}

}

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

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

<script language=vbscript>

dim lcountmx

lcountmx =

function badd(stidstNamevcidvcNameggidggNamedweisliangdjia)

lcountmx=lcountmx+

dim oRowoCellii

set oRow=tabzxinsertRow

orowid=trzx & lcountmx

set ocell=orowinsertcell

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

ocellinnerhtml= sss

ocellclassname=ListCellRow

set ocell=orowinsertcell

ocellclassname=ListCellRow

ocellalign=center

ocellwidth=

ocellinnerhtml=<input type=hidden name=vcName & lcountmx & value= & vcName & >& vcName

set ocell=orowinsertcell

ocellclassname=ListCellRow

ocellalign=center

ocellwidth=

ocellinnerhtml=<input type=hidden name=ggName & lcountmx & value= & ggName & >& ggName

set ocell=orowinsertcell

ocellclassname=ListCellRow

ocellalign=center

ocellwidth=

ocellinnerhtml=<input type=text size= name=thao & lcountmx & value=>

set ocell=orowinsertcell

ocellclassname=ListCellRow

ocellalign=center

ocellwidth=

ocellinnerhtml=<input type=hidden name=dwei & lcountmx & value= & dwei & >& dwei

set ocell=orowinsertcell

ocellclassname=ListCellRow

ocellalign=center

ocellwidth=

ocellinnerhtml=<input type=text size= name=sliang & lcountmx & onchange=changeFun( & lcountmx & ) value=>

<%

set ocell=orowinsertcell

ocellclassname=ListCellRow

ocellalign=center

ocellwidth=

ocellinnerhtml=<input type=text size= name=djia & lcountmx & onchange=changeFun( & lcountmx & ) value=>

%>

set ocell=orowinsertcell

ocellclassname=ListCellRow

ocellinnerhtml=<input type=button value=删除 onClick=vbscript:bdel( & lcountmx & ) id=button name=button>

ocellalign=center

documentapplicationsFormypslvalue = lcountmx

end function

function bdel(l)

tabzxdeleteRow documentgetElementById(trzx & l)rowindex

end function

function changeFun(obj)

change obj

end function

function changeFun(obj)

change obj

end function

</script>

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

选择设备页面的调用代码如下

<SCRIPT LANGUAGE=vbscript>

选择多种用品并返回到主页面

function doOk(sFlag)

Dim StrIDmnewStrIDiinewStrID_

StrID=

for each m in FormEditelements

IF mtype=checkbox then

if mchecked and mname <> selectAllCheck then

if StrID = then

StrID= mvalue

else

StrID=StrID & & mvalue

end if

end if

END IF

NEXT

IF StrID<> THEN

newStrID = Split(StrID)

for ii= to ubound(newStrID)

newStrID(ii) = replace(newStrID(ii)()

newStrID_ = Split(newStrID(ii))

windowopenerbadd newStrID_()newStrID_()newStrID_()newStrID_()newStrID_()newStrID_()newStrID_()newStrID_()newStrID_()

next

if sFlag then

windowclose

end if

else

msgbox 您没有选择任何用品! vbExclamation提示

exit function

END IF

End function

</SCRIPT>               

上一篇:ASP学习:史上最强的数据分页方法

下一篇:ASP通用文章分页函数:非记录集分页