一个简单的弹出div,div里是一个表格

5 篇文章 0 订阅

先看效果图:


默认时来时,产品信息是隐藏的;点击链接时显示,再点一下隐藏,或点X隐藏。

代码在jsp中写的,代码如下:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--  "http://www.w3.org/TR/html4/loose.dtd" -->
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>产品详细</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
		*{ margin:0; padding:0; font-size:12px;}
		.windows-container {position:absolute;background:#fff; border:1px solid #dfe7ed; width:300px; min-height:120px;}
		.windows-container h2 { position:relative; background:#378dd4; color:#fff; height:30px;line-height:30px; padding-left:5px;}
		.windows-container h2 a { position:absolute; right:3px; top:0px; text-decoration:none; color:#fff;}
		.windows-data {min-height: 20px;max-height: 100px;overflow: auto;}
		.datalist { border-collapse:collapse; width:100%;}
		.datalist th { background:#fdfdfd;}
		.datalist th, .datalist td { border:1px solid #f8f8f8; line-height:2;text-align: center;}
	</style>
	<script type="text/javascript" src="<%=path%>/resources/js/jquery-1.9.1.js"></script> 
	<script type="text/javascript">
	function productdetail(){
		var os = $('#div').offset();
		$('#productdetail').css({"left":os.left,"top":os.top}).toggle();//定位在os位置,并加入显示隐藏效果
	}
	
	</script>

  </head>
  
  <body>
  	<div id="hot_area" class="hot_area"><a href="javascript:productdetail(1);">共有6个产品</a></div>
  	<div id="div" style="width:400px;height:200px;background:#54dab3;margin-left:10px;"></div>
	<div id="productdetail" class="windows-container" style="display: none;">
		<h2>
			<span>产品详细</span><a href="javascript:productdetail();">×</a>
		</h2>
		<div class="windows-contents">
			<table class="datalist">
				<colgroup>
					<col width="80px" />
					<col width="100px" />
					<col width="*" />
				</colgroup>
				<thead>
					<tr>
						<th>产品类型</th>
						<th>产品号码</th>
						<th>入网时间</th>
					</tr>
				</thead>
			</table>
		</div>
		<div class="windows-data">
			<table class="datalist">
				<colgroup>
					<col width="80px" />
					<col width="100px" />
					<col width="*" />
				</colgroup>
				<tbody class="ccaa">
					<tr>
						<td>宽带</td>
						<td>43050453</td>
						<td>20080128</td>
					</tr>
					<tr>
						<td>宽带</td>
						<td>43050453</td>
						<td>20080128</td>
					</tr><tr>
						<td>宽带</td>
						<td>43050453</td>
						<td>20080128</td>
					</tr><tr>
						<td>宽带</td>
						<td>43050453</td>
						<td>20080128</td>
					</tr><tr>
						<td>宽带</td>
						<td>43050453</td>
						<td>20080128</td>
					</tr>
					<tr>
						<td>宽带</td>
						<td>43050453</td>
						<td>20080128</td>
					</tr>
				</tbody>
			</table>
		</div>
	</div>
</body>
</html>


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值