码迷,mamicode.com
首页 > 其他好文 > 详细

struts2中用iframe遮罩frameset

时间:2014-06-17 19:46:51      阅读:171      评论:0      收藏:0      [点我收藏+]

标签:style   class   java   tar   ext   color   

项目中遇到的遮罩问题

///////////////////////////////////index.jsp/////////////////////////////////////////

<html>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
 <head>
  <style type="text/css">
   #greyLayer{position:absolute;top:0;left:0;background-color:#fff;display:true;opacity:.5;filter:alpha(opacity=50)} 
   #privacyLayer{width:800px;height:500px;border:1px solid #656451;position:absolute;top:200px;left:300px;background-color:#fff;display:none;z-index:10000; text-align:center;} 
   #privacyLayer .title{line-height:30px;font-weight:bold;padding:0;margin:0;font-size:16px;text-align:center;background-color:#FFFFCF;border-bottom:1px solid #656451} 
   #privacyLayer .con{} 
   #privacyLayer .btn{line-height:20px;text-align:center;margin-top:20px;} 
   #privacyLayer .r{line-height:40px;color:#000;font-weight:bold;font-size:14px;} 
   #privacyLayer .c{line-height:40px;color:#000;font-size:13px;}
   
   .mask { position: absolute; top: 0px; filter: alpha(opacity=60); background-color: #777; 
              z-index: 1002; left: 0px; 
              opacity:0.5; -moz-opacity:0.5;  }  
  </style>
  <title></title>
  <script src="js/jquery.js" type="text/javascript"></script>
  <script type="text/javascript">
   //兼容火狐、IE8 
      function showMask(){ 
          $("#mask").css("height",$(document).height()); 
          $("#mask").css("width",$(document).width()); 
          $("#mask").show(); 
      } 
   function openPrivacyLayer(){ 
/*    var greyLayer = document.getElementById(‘greyLayer‘); 
    with(greyLayer.style){ 
       display = ‘block‘; 
       height = document.body.scrollHeight+‘px‘; 
       width = document.body.scrollWidth+‘px‘; 
    } 
*/    
    showMask();
    var top1; 
    var left1; 
    var diffY; 
    if (document.documentElement && document.documentElement.scrollTop) 
    { 
        diffY = document.documentElement.scrollTop; 
        left1 = document.documentElement.scrollLeft; 
        //alert(diffY); 
        } 
    else if (document.body){ 
        diffY = document.body.scrollTop; 
        left1 = document.body.scrollLeft; 
        //alert(diffY); 
    } 
    else 
        {/*Netscape stuff*/} 
    var privacyLayer = document.getElementById(‘privacyLayer‘); 
    var xWidth = privacyLayer.currentStyle.width; 
    var xHeight = privacyLayer.currentStyle.height; 
    if (xWidth == ‘null‘ || xWidth == ‘‘) 
    { 
        xWidth = window.getComputedStyle(privacyLayer,null).style.width; 
        xHeight = window.getComputedStyle(privacyLayer,null).style.width; 
    } 
    xWidth = parseInt(xWidth.replace("px",""),10); 
    xHeight = parseInt(xHeight.replace("px",""),10); 
    //alert(xHeight); 
    with(privacyLayer.style){ 
       display = ‘block‘; 
       left = left1+((window.innerWidth || document.documentElement && document.documentElement.clientWidth || document.body.offsetWidth)-xWidth)/2+‘px‘; 
       top = diffY + ((window.innerHeight || document.documentElement && document.documentElement.clientHeight || document.body.offsetHeight)-xHeight)/2+‘px‘; 
    } 
   } 
   var ii = 20;
   function showDisabled(){
    ii = parseInt(ii) - 1;
    if(ii<1){
     document.getElementById(‘close‘).innerHTML = ‘<a href="javascript:closePrivacy()" id="closePrivacy" >阅读完毕</a>‘;
    }else{
     document.getElementById(‘close‘).innerHTML = ii+‘秒后阅读完毕‘;
     setTimeout(‘showDisabled()‘,1000);
    }
   }
   
   setTimeout(‘showDisabled()‘,1000);
   
   function closePrivacy(){ 
    document.forms[0].action="getInstancyAnnouncementByUser.action";
    document.forms[0].submit(); 
   } 
   
   function sendReceipt2(){ 
    document.forms[0].action="sendReceipt2.action";
    document.forms[0].submit(); 
   } 
   
  </script>
 </head>
 <body onload="openPrivacyLayer();">
  <form>
   <div id="mask" class="mask"></div>
   <iframe id="greyLayer" width="100%" height="100%" src="main.jsp"></iframe>
   <s:iterator id="announcement" value="instancyAnnouncements" status="i">
   <input type="hidden" id="id" name="announcement.id" value="<s:property value="announcement.id"/>"/>
   <div id="privacyLayer">
   <h1 class="title"> 紧    急    公    告</h1>
   <div class="r">标题:<s:property value="announcement.title"/></div>
   <div class="c">
   <table>
    <tr height="30">
     <th width="150">公告类别: </th>
     <td>
      <s:property value="announcement.announcementCategoryName"/>
     </td>
     <th width="150">公告子类别:
     </th>
     <td><s:property value="announcement.subAnnouncementCategoryName"/>
     </td>
    </tr>
    <tr>
     <th width="150">
      优先级:
     </th>
     <td>
      <s:property value="announcement.priorityName"/>
     </td>
     <th>有效时间:</th>
     <td><s:property value="announcement.startEffectiveDate"/> 到  <s:property value="announcement.endEffectiveDate"/></td>
    </tr>
    <tr height="30">
     <th width="150">
      发送人:
     </th>
     <td>
      <s:property value="announcement.sendPersonName"/>
     </td>
     <th width="150">
      发送时间:
     </th>
     <td>
      <s:property value="announcement.sendDate"/>
     </td>
    </tr>
   </table>
   </div>
   <div id="privacyContent" class="con">
   <div><textarea cols="80" rows="25" wrap="virtual" style="width:90%;font-size:14.9px;height:320px;" readonly="readonly">公告内容:<s:property value="announcement.content"/></textarea></div>
   <div><table>
    <s:iterator id="announcementUploadFile" value="announcementUploadFileList" status="i">
    <tr>
     <th>附件:</th>
     <td>
      <a href="downAnnouncementUploadFile.action?announcementUploadFile.id=<s:property value="#announcementUploadFile.id"/>"><s:property value="#announcementUploadFile.fileName"></s:property></a>
     </td>
    </tr>
   </s:iterator>
   </table></div>
   </div>
   <div class="btn"><div id="close" >20秒后阅读完毕</div></div>
   </div>
   </s:iterator>  
  </form>
 </body>
</html>

 

////////////////////////main.jsp/////////////////////////////

<html>
<head>
<title></title>
<link id="index_link_easyuiThemes" rel="stylesheet" href="<%=basePath%>js/jquery-easyui-1.2.5/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="<%=basePath%>/js/jquery-easyui-1.2.5/themes/icon.css"/>
<link href="<%=basePath%>CSS/pages.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="<%=basePath%>js/common.js" ></script>
<script language="javascript" type="text/javascript" src="<%=basePath%>js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" charset="UTF-8" src="<%=basePath%>/js/jquery-easyui-1.2.5/jquery-1.7.1.min.js"/></script>
<script type="text/javascript"  src="<%=basePath%>js/jquery-easyui-1.2.5/jquery.easyui.min.js"/>
<script type="text/javascript"  src="<%=basePath%>js/jquery-easyui-1.2.5/locale/easyui-lang-zh_CN.js"/>
<script type="text/javascript" charset="UTF-8" src="<%=basePath%>js/jquery-easyui-1.2.5/easyuiUtil.js"/>
 <script type="text/javascript"> jQuery.noConflict();</script>
</head>
<frameset rows="108,*"  frameborder="no" border="0" framespacing="0" name="allFrame">
 <frame src="getLoginUserShow.action" name="topFrame"  scrolling="no" noresize>   
 <frameset rows="*,30"  frameborder="no" border="0" framespacing="0" name="bodyFrame">
  <frameset cols="230,*"  frameborder="no" border="0" framespacing="0" name="menuFrame">
   <frame src="getUserMenuList.action" name="menu" id="menu" scrolling="auto" noresize>
   <frameset  cols="6,*"  frameborder="no" border="0" framespacing="0" name="mainFrame">
    <frame src="switch.jsp" name="switch" id="switch1"  scrolling="no" noresize>   
    <frame id="right" src="right.jsp" name="right" scrolling="auto" noresize>
   </frameset>
  </frameset>
  <frame src="foot.jsp" name="footFrame"  scrolling="no" noresize>   
 </frameset>
</frameset>
</html>

 

 

struts2中用iframe遮罩frameset,布布扣,bubuko.com

struts2中用iframe遮罩frameset

标签:style   class   java   tar   ext   color   

原文地址:http://www.cnblogs.com/weifeng0729/p/3792272.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!