<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<!-- 请注意,别忘了引入jquery.js-->

<script src="js/jquery.js"></script>

<script type="text/javascript">

function showDiv(){
 var str = "这里边是定义的浮动层的显示内容,实际应用中应该是从数据库动态读取的内容</br>能接受html标签,但要将双引号转为单引号这里边是定义的浮动层的显示内容,实际应用中应该是从数据库动态读取的内容</br>能接受html标签,但要将双引号转为单引号使用这里边是定义的浮动层的显示内容,实际应用中应该是从数据库动态读取的内容</br>能接受html标签号使用使用";
 
 $("#p1").html(str);
 var wid = $(window).width();
 var hei = $(window).height();
 var lef = (wid - 400)/2+"px";
 var heii = (hei - 200)/2+"px";
 $("#dialog").css({
  "z-index":"5",
  "position":"absolute",
  "display":"block",
  "width":"500px",
  "height":"400px",
  "left":lef,
  "top":heii,
  "background":"#EEEEEE",
  "color":"blue",
  "border":"1px solid red"
 });
}

function closeDive(){
 $("#dialog").slideUp("1000");
}

</script>

</head>

<body>

<div id="div1" onClick="showDiv()" style="width:70px; height:20px; background-color:#FF9933">
&nbsp;&nbsp;&nbsp;点击</div>


<div id="dialog" style="display:none;padding:8px;">
 <div id='close' style="text-align:right; padding-right:40px;" onClick="closeDive()">关闭</div>
 <div id="p1"></div>
</div>

</body>
</html>