- 爱易网页
 
                        - 
                            Java教程
 
                        - jsp怎么实现点击单元格弹出小窗口并显示其详细信息,js也行啊求指教 
 
                         
                    
                    
                    日期:2014-05-17  浏览次数:20878 次 
                    
                        
                         jsp如何实现点击单元格弹出小窗口并显示其详细信息,js也行啊!求指教!
我现在实现的是在查看页面显示数据库中一条记录的部分信息,表格形式
想实现点击一下表格的第一列的单元格,就可以弹出一个对话框显示数据库中所有字段的值
求各位大侠的解决,好郁闷。。搞死了。。。
------解决方案--------------------
js方法
/**
		 *	显示人员详细信息 	
		 */
		function showUserDetail(userId) {
			window.showModalDialog("<%=path %>/basicInfo/user/user!detail.action?userId=" + userId + "&d=" + new Date(), self, 'dialogHeight:600px;dialogWidth:600px;center:yes;middle:yes;help:no;location:no;status:no;scroll:yes');
		}
页面:
<td class="List_table_text"><a href="javascript:showUserDetail('${userInfo.userId}')"><c:out value="${userInfo.name}"/></a></td>
后台:
/**
	 *  根据用户ID查询员工详细
	 * @return
	 * @throws Exception
	 */
	public String detail() throws Exception {
		userDetail = userService.getUserInfoById(userId);
		return "detail";
	}
详细页面:
<div id="btn_title_area" style="width:95%;margin:10px auto 5px auto"><img src="<%=frameroot%>/image/icon_title.gif" align="absmiddle" />  人员信息详细</div>
<input type="hidden" value="${userDetail.userId}" name="userId" id="userId">
<s:form id="mytable" theme="simple" name="mytable">
	<table width="95%" border="0" cellpadding="0" cellspacing="0" align="center" class="table_list">
			<tr>
				<th style="width:25%">员工编号:</th>
				<td colspan="3">
					<c:out value="${userDetail.userNo}"></c:out>
				</td>
			</tr>
			<tr>
				<th>姓名:</th>
				<td>
					<c:out value="${userDetail.name}"></c:out>
				</td>
			</tr>
			<tr>
				<th style="width:20%">用户名:</th>
				<td colspan="3">
					<c:out value="${userDetail.userName}"></c:out>
				</td>
			</tr>
			<tr>
				<th>性别:</th>
				<td>
					<c:if test="${userDetail.sex == 1}">
						<c:out value="女"/>
					</c:if>
					<c:if test="${userDetail.sex  == 0}">
						<c:out value="男"/>
					</c:if>
				</td>
			</tr>
			<tr>
				<th>身份证号:</th>
				<td>
					<c:out value="${userDetail.identityId}"></c:out>
				</td>
			</tr>
				<th>机构:</th>
				<td>
					<c:out value="${userDetail.org.departmentName}"></c:out>
				</td>
			</tr>
				<th>部门:</th>
				<td>
					<c:out value="${userDetail.department.departmentName}"></c:out>
				</td>
			</tr>
				<th>级别:</th>
				<td>
					<c:out value="${userDetail.level.masterValue}"></c:out>
				</td>
			</tr>
			</tr>
				<th>头衔:</th>
				<td>
					<c:out value="${userDetail.title.masterValue}"></c:out>
				</td>
			</tr>
			<tr>
				<th>是否有试用期:</th>
				<td>
					<c:choose>
						<c:when test="${userDetail.isTry == 1}">是</c:when>
						<c:otherwise>否</c:otherwise>
					</c:choose>
				</td>