個申請單可以包含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(
formEdit
supplyId
)
><font
color=
FF
>選擇設備</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:
px;status:no;scroll:no;dialogHeight:
px
);
if (k!=null)
{
var url =
/applicationsAction
do?method=insertAddSeach&stId=
+k[
]+
&sbId=
+k[
]+
&ggId=
+k[
];
window
open(url
newwindow
height=
width=
toolbar=no
menubar=no
scrollbars=yes
resizable=no
location=no
status=no
);
}
}
=========================
根據選擇動態添加數據代碼
<script language=
vbscript
>
dim lcountmx
lcountmx =
function badd(stid
stName
vcid
vcName
ggid
ggName
dwei
sliang
djia)
lcountmx=lcountmx+
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=
ocell
innerhtml=
<input type=hidden name=vcName
& lcountmx &
value=
& vcName &
>
& vcName
set ocell=orow
insertcell
ocell
classname=
ListCellRow
ocell
align=
center
ocell
width=
ocell
innerhtml=
<input type=hidden name=ggName
& lcountmx &
value=
& ggName &
>
& ggName
set ocell=orow
insertcell
ocell
classname=
ListCellRow
ocell
align=
center
ocell
width=
ocell
innerhtml=
<input type=text size=
name=thao
& lcountmx &
value=
>
set ocell=orow
insertcell
ocell
classname=
ListCellRow
ocell
align=
center
ocell
width=
ocell
innerhtml=
<input type=hidden name=dwei
& lcountmx &
value=
& dwei &
>
& dwei
set ocell=orow
insertcell
ocell
classname=
ListCellRow
ocell
align=
center
ocell
width=
ocell
innerhtml=
<input type=text size=
name=sliang
& lcountmx &
onchange=
changeFun(
& lcountmx &
)
value=
>
<%
set ocell=orow
insertcell
ocell
classname=
ListCellRow
ocell
align=
center
ocell
width=
ocell
innerhtml=
<input type=text size=
name=djia
& lcountmx &
onchange=
changeFun
(
& lcountmx &
)
value=
>
%>
set ocell=orow
insertcell
ocell
classname=
ListCellRow
ocell
innerhtml=
<input type=
button
value=
刪除
onClick=
vbscript:bdel(
& lcountmx &
)
id=button
name=button
>
ocell
align=
center
document
applicationsForm
ypsl
value = lcountmx
end function
function bdel(l)
tabzx
deleteRow document
getElementById(
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 StrID
m
newStrID
ii
newStrID_
StrID=
for each m in FormEdit
elements
IF m
type=
checkbox
then
if m
checked and m
name <>
selectAllCheck
then
if StrID =
then
StrID= m
value
else
StrID=StrID &
& m
value
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)
)
window
opener
badd newStrID_
(
)
newStrID_
(
)
newStrID_
(
)
newStrID_
(
)
newStrID_
(
)
newStrID_
(
)
newStrID_
(
)
newStrID_
(
)
newStrID_
(
)
next
if sFlag then
window
close
end if
else
msgbox
您沒有選擇任何用品!
vbExclamation
提示
exit function
END IF
End function
</SCRIPT>
From:http://tw.wingwit.com/Article/program/net/201311/13705.html