如何实现申请单的动态添加(WEB页面)
2008-08-25 13:51
621 查看
一个申请单可以包含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>
====================
选择设备页面的调用代码如下
<SCRIPT LANGUAGE=vbscript>
'选择多种用品并返回到主页面
function doOk(sFlag)
Dim StrID,m,newStrID,ii,newStrID_1
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=0 to ubound(newStrID)
newStrID(ii) = replace(newStrID(ii),"(",",")
newStrID_1 = Split(newStrID(ii),",")
window.opener.badd newStrID_1(0),newStrID_1(1),newStrID_1(2),newStrID_1(3),newStrID_1(4),newStrID_1(5),newStrID_1(6),newStrID_1(7),newStrID_1(8)
next
if sFlag then
window.close
end if
else
msgbox "您没有选择任何用品!" ,vbExclamation,"提示"
exit function
END IF
End function
</SCRIPT>
动态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>
====================
选择设备页面的调用代码如下
<SCRIPT LANGUAGE=vbscript>
'选择多种用品并返回到主页面
function doOk(sFlag)
Dim StrID,m,newStrID,ii,newStrID_1
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=0 to ubound(newStrID)
newStrID(ii) = replace(newStrID(ii),"(",",")
newStrID_1 = Split(newStrID(ii),",")
window.opener.badd newStrID_1(0),newStrID_1(1),newStrID_1(2),newStrID_1(3),newStrID_1(4),newStrID_1(5),newStrID_1(6),newStrID_1(7),newStrID_1(8)
next
if sFlag then
window.close
end if
else
msgbox "您没有选择任何用品!" ,vbExclamation,"提示"
exit function
END IF
End function
</SCRIPT>
相关文章推荐
- 如何实现服务器端下页面动态添加JavaScript脚本
- 如何实现服务器端下页面动态添加JavaScript脚本
- 如何实现服务器端下页面动态添加JavaScript脚本
- 如何在web页面中实现连接数据库的动态的组织结构图?
- 如何实现服务器端下页面动态添加JavaScript脚本
- 实现Web页面内容动态改变的dhtml操作
- Web浏览器中动态添加修改HTML页面代码的问题分析
- 如何用PHP来实现一个动态Web服务器
- webSocket 如何实现服务器端 想页面推送实时数据? 动态数据?如何进行连接?
- JavaScript实现动态添加页面的表格行数并获取数据
- 实现Web页面内容动态改变的dhtml操作http://www.knowsky.com/4074.html
- 实现Web页面内容动态改变的dhtml操作
- ViewPager实现TabHost动态添加、删除Fragment,用红色小圆球指示当前页面
- 如何实现设置页面顶部添加导航栏,以及自定义风格
- JavaScript实现页面动态添加图片
- liferay 如何在页面实现添加多个portlet
- ASP申请单动态添加实现方法及代码
- Ajax的常用技巧(6)---实现web页面局部动态刷新
- 熟悉IBatisNet的兄弟,探讨下 如何实现 动态添加SQL语句,查询出随时所需的信息
- 如何实现添加多条信息到GridView中,而一次保存到数据库,不被页面刷新而丢失数据呢?