2013-11-15 103 views
0

在我的项目中,我想让一个jsp页面在单击按钮时显示淡出并显示父页面(后面)。淡入淡出JSP页面

<html> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
    <title>JSP Page</title> 
    <style type="text/css"> 
     <!-- 
     .style1 { 
      font-family: Arial, Helvetica, sans-serif; 
      font-weight: bold; 
      font-size: 12px; 
     } 
     --> 
    </style> 
    <link href="css/buttons.css" rel="stylesheet" type="text/css"/> 
</head> 
<body> 
    <form name="form1" method="post" action="analystServlet"> 
     <table width="100%" border="0" cellspacing="1" cellpadding="1"> 
      <tr> 
       <td>&nbsp;</td> 
       <td>&nbsp;</td> 
      </tr> 
      <tr> 
       <td><span class="style1">Choose Source</span></td> 
       <td><select name="source"> 
         <option>Excel</option> 
         <option>Database</option> 
        </select></td> 
      </tr> 
      <tr> 
       <td><input type="hidden" name="id" value="494"/></td> 
       <td>&nbsp;</td> 
      </tr> 
      <tr> 
       <td colspan="2"><div align="center"> 
         <input type="submit" class="button" onclick="hide()" name="exportHome" value="Submit"/> 
        </div></td> 
      </tr> 
     </table> 
    </form> 

</body> 

当我点击提交按钮,这个页面已经被褪去。 谢谢, Karthika KM

+0

你怎么躲在一个jsp是什么意思?你想隐藏你的JSP一些元素基于某些按钮点击? – Renjith

+0

plz,分享你的代码试试 – Arvind

+0

我只想隐藏一个页面。 – user2990782

回答

2

您可以用做阿贾克斯/ jQuery的只有

function closeMe() 
     {  
      window.opener.location.reload(true); // reload parent page 
      window.close(); // close this page     
     } 

    $("#submitbtn").click(function(e) { 
      e.preventDefault(); 

     var params = { 
        // here pass form parameter 
       }; 

    $.ajax({ 
      type: "POST", 
      url: "/analystServlet", 
      data: params, 
      success: function(data){ 

       $('body').css("background", "rgba(0,0,0,0.5)").fadeOut("slow"); 
       setTimeout(function() { 
        closeMe(); 
       }, 1000); // 1000 = 1 secs           
      }       
    }); // end of $.ajax()