0

在我的项目中,我想在单击按钮时使 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

4

1 回答 1

2

您只能使用 ajax/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()
于 2013-11-15T13:07:22.753 回答