【JSP开源代码栏目提醒】:以下是网学会员为您推荐的JSP开源代码-book.jsp,希望本篇文章对您学习有所帮助。
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
<html>
<head>
<link rel="STYLESHEET" type="text/css" href="css/shared.css">
<title>
book
</title>
<script language="javascript">
var selectedTr = null;
function setTrColor(colorTr,color)
{
if(colorTr.tagName=="TR")
{
for(var i=0;i<colorTr.childNodes.length;i++)
{
colorTr.childNodes(i).style.backgroundColor = color;
colorTr.childNodes(i).children(0).style.backgroundColor = color;
}
}
}
function addbook()
{
document.bookActionForm.operation.value = "add";
document.bookActionForm.submit();
}
function deletebook()
{
if(selectedTr!=null)
{ alert(selectedTr.childNodes(0).children(1).value);
if(selectedTr.childNodes(0).children(1).value!=0&&selectedTr.childNodes(0).children(1).value!=null)
{
document.bookActionForm.deleteUID.value = selectedTr.childNodes(0).children(1).value;
document.bookActionForm.operation.value="delete";
bookRows.removeChild(selectedTr);
selectedTr = null;
document.bookActionForm.submit();
}else
{
bookRows.removeChild(selectedTr);
selectedTr = null;
}
}
}
function savebook()
{
document.bookActionForm.operation.value = "save";
document.bookActionForm.submit();
}
function onClickedCell()
{
var clickedcell = event.srcElement;
if(selectedTr!=null)
{
setTrColor(selectedTr,"#FFFFFF");
}
while(clickedcell.tagName!="TR")
{
clickedcell = clickedcell.parentElement;
}
selectedTr = clickedcell;
setTrColor(selectedTr,"#FFDDFF");
}
</script>
</head>
<body bgcolor="#ffffff" >
<h3 align="center">
图书信息
</h3>
<br>
<hr height=1 />
<html:form method="post" action="bookAction.do">
<html:hidden name="bookActionForm" property="deleteUID" />
<html:hidden name="bookActionForm" property="operation"/>
<table width="100%">
<tr>
<td class="tdframe">
<table class="table1" width="100%">
<thead class="tdsectionbar">
<td align="center" class="tdsectionbar" >图书名称</td>
<td align="center" class="tdsectionbar" >图书数量</td>
</thead>
<tbody id="bookRows" onclick="onClickedCell()">
<logic:iterate name="bookActionForm" property="books" id="books">
<tr class="tdsectionbar">
<td class="tdbg0" >
<html:text indexed="true" name="books" property="bookName" />
<html:hidden indexed="true" name="books" property="bookUID" />
</td>
<td class="tdbg0" >
<html:text indexed="true" name="books" property="totalQty" />
<html:hidden indexed="true" name="books" property="qty" />
</td>
</tr>
</logic:iterate>
</tbody>
</table>
</td>
</tr>
</table>
</html:form>
<br><br>
<input type="button" value="添加图书" class="button" onclick="addbook()"/>
<input type="button" value="删除图书" class="button" onclick="deletebook();"/>
<input type="button" value="保存图书" class="button" onclick="savebook();"/>
<hr height=1 />
</body>
</html>
上一篇:
bodytag.jsp
下一篇:
分娩球配合自由体位助产的临床研究