table thead tr th {
border: 1px solid black;
padding: 3px;
background-color: #cccccc;
background-color: expression(this.rowIndex % 2 == 0 ? "#FFFFFF" : "#EEEEEE");
}
table tbody tr td {
border: 1px solid black;
padding: 3px;
}
.trs{
background-color: expression(this.rowIndex % 2 == 0 ? "#FFFFFF" : "#EEEEEE");
}
<%@page pageEncoding="GBK" contentType="text/html; charset=GBK"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>游戏管理</title>
</head>
<style type="text/css">
table {
border: 1px solid black;
border-collapse: collapse;
}
table thead tr th {
border: 1px solid black;
padding: 3px;
background-color: #cccccc;
background-color: expression(this.rowIndex % 2 == 0 ? "#FFFFFF" : "#EEEEEE");
}
table tbody tr td {
border: 1px solid black;
padding: 3px;
}
.trs{
background-color: expression(this.rowIndex % 2 == 0 ? "#FFFFFF" : "#EEEEEE");
}
</style>
<script language="JavaScript">
function doSearch(){
if(document.all.searchValue.value=="")
{
alert("请输入查询关键字!");
}else{
window.location.href="/game/products/list.action?queryName="+document.all.searchName.value+"&&queryValue="+document.all.searchValue.value;
}
}
</script>
<body>
<table align="center">
<tr align="right">
<td><a href="<s:url action="list" includeParams="none"/>">查看所有对象</a>
<a href='<s:url action="edit" ></s:url>'>创建新对象</a> <select
name="searchName">
<option value="gameNameCn">中文名称</option>
<option value="gameNameEn">英文名称</option>
<option value="gameCapacity">碟数</option>
<option value="gameVersion">版本</option>
<option value="gameMedia">介质</option>
<option value="gameCopyright">版权</option>
</select> <input type="text" name="searchValue" value="" size="10" /> <input
type="button" value="查询" onClick="doSearch();"></td>
</tr>
<tr>
<td>
<table cellspacing="0" align="center">
<thead>
<tr>
<th>中文名称</th>
<th>英文名称</th>
<th>碟数</th>
<th>版本</th>
<th>介质</th>
<th>版权</th>
<th>价格</th>
<th>攻略</th>
</tr>
</thead>
<tbody>
<s:iterator value="availableItems">
<tr class="trs">
<td><a
href='<s:url action="edit" ><s:param name="gameId" value="gameId" /></s:url>'>
<s:property value="gameNameCn" /> </a></td>
<td><s:property value="gameNameEn" /></td>
<td><s:property value="gameCapacity" /></td>
<td><s:if test="1 == gameVersion">
中文版
</s:if> <s:elseif test="2 == gameVersion">
英文版
</s:elseif></td>
<td><s:if test="1 == gameMedia">
CD
</s:if> <s:elseif test="2 == gameMedia">
DVD5
</s:elseif></td>
<td><s:if test="1 == gameCopyright">
正版
</s:if> <s:elseif test="2 == gameCopyright">
翻版
</s:elseif></td>
<td><s:property value="gamePrice" /></td>
<td><s:property value="gameContent" /></td>
</tr>
</s:iterator>
<tr align="right">
<td colspan="9">共<s:property value="totalRows" />行
第<s:property value="currentPage" />页 共<s:property
value="pager.getTotalPages()" />页 <a
href="<s:url value="list.action">
<s:param name="currentPage" value="currentPage"/>
<s:param name="pagerMethod" value="'first'"/>
</s:url>">首页</a>
<a
href="<s:url value="list.action">
<s:param name="currentPage" value="currentPage"/>
<s:param name="pagerMethod" value="'previous'"/>
</s:url>">上一页</a>
<a
href="<s:url value="list.action">
<s:param name="currentPage" value="currentPage"/>
<s:param name="pagerMethod" value="'next'"/>
</s:url>">下一页</a>
<a
href="<s:url value="list.action">
<s:param name="currentPage" value="currentPage"/>
<s:param name="pagerMethod" value="'last'"/>
</s:url>">尾页</a>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</body>
</html>
本文介绍了一个游戏管理界面的设计实现,包括使用Struts标签库进行页面布局、通过JavaScript进行查询功能的交互,以及如何利用CSS样式美化表格显示效果。

table
1033

被折叠的 条评论
为什么被折叠?



