【问题标题】:Capture window state in a form,在表单中捕获窗口状态,
【发布时间】:2013-11-09 20:33:09
【问题描述】:

我有一个用于打印页面基本内容的表单。该页面具有可以显示或隐藏的列。我想确定哪些列被显示,哪些被隐藏以传递给打印例程。我正在尝试使用表单来传递它,但似乎无法让它发挥作用。

<tr><td align='left' width='100'>
<form action='print_plan.php' method='post'       name='printplan' target='_blank'>
<input type='hidden' id='PlanNo' name='PlanNo' value='13' />
<input type='hidden' id='IDuser' name='IDuser' value='1' />
<script language='javascript' type='text/javascript'>
 document.write("<input type='hidden' id='detCols' name='detCols' value='",details,"' />")
</script>
<input name='Submit' type='image' value='print' title='Print Plan'  src='images/print.gif'
           alt='Print Plan' onclick='detailCols()' /></form></td>

其中 detailCols 将生成一个全局变量“详细信息”,其中包含正在显示的列集的位掩码。

【问题讨论】:

    标签: javascript forms input global-variables user-defined-functions


    【解决方案1】:

    我不确定,但这可能是答案: 尝试将您的隐藏字段静态添加到 html,并使用 null 值。然后使用 jQuery 动态设置它的值:

    <td align='left' width='100'>
    <form action='print_plan.php' method='post' name='printplan' target='_blank'>
    <input type='hidden' id='PlanNo' name='PlanNo' value='13' />
    <input type='hidden' id='IDuser' name='IDuser' value='1' />
    <input type='hidden' id='detCols' name='detCols' value='' />
    <input name='Submit' type='image' value='print' title='Print Plan'  src='images/print.gif'
               alt='Print Plan' onclick='detailCols()' />
    </form>
    </td>
    

    jQuery

    $(document).ready(function(){
        $("#detCols").val(details);
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多