0
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>

<button id="hidr">Hide</button>
<button id="showr">Show</button>
<div>
<span style='display:none'>

<?php
    <form id='form1' name='form1' method='post' action='do.php?sales/new_stat_rep'>
        <table  class='generic'>

        <tr bgcolor='13a0ff'><td colspan='6'><center><b>CREATE STATUS REPORT</b></center></td></tr>
            <tr bgcolor='4ab6ff'>
                <td>J.O. Date</td><td><input type='text' name='sm_jodate' value='MM/DD/YYYY' onfocus='showCalendarControl(this)' style='width:100%'></td>
                <td>Proposal Number</td><td><input type='text' name='sm_proposalno' style='width:100%'></td>
                <td>Project Duration</td><td><input name='sm_proj_duration' type='text' style='width:100%'></td>
            </tr>

        </table>
            <input type='submit' value='Save' name='sumbit'>
            <input type='hidden' name='button' value='yes'>
    </form>

?>

    </span>

  </div>

<script>
    $("#showr").click(function () {
      $("span").show(1000);
    });
    $("#hidr").click(function () {
      $("span:last-child").hide("fast", function () {
        // use callee so don't have to name the function
        $(this).prev().hide("fast", arguments.callee); 
      });
    });


</script>

此代码首先有一个隐藏和显示的 2 按钮。为了查看表单,用户必须单击显示。我担心的是,如果我在表单中提交输入时可能会关闭,除非用户单击隐藏。按钮,以及如何做到这一点

4

2 回答 2

0

尝试这个

<input type='submit' value='Save' name='sumbit' id="SubmitFrm">

在您的脚本中添加以下代码

$("#SubmitFrm").click(function(){
     $("#hidr").click();
});
于 2012-09-27T06:28:49.417 回答
0
$("#showr").click(function () {
  $("span").show(1000);
});
$("#hidr").click(function () {
  $("span:last-child").hide("fast", function () {
    // use callee so don't have to name the function
    $(this).prev().hide("fast", arguments.callee); 
  });
});
$("#submit").click(function(e){
   e.preventDefault();
   $("#form1").submit();
});

尝试这个。这是工作。将 id 添加到您的提交按钮(在我的代码中为 id="submit")。

演示

于 2012-09-27T06:45:02.077 回答