在HTML文本框之间传递输入数据

时间:2013-10-19 19:21:26

标签: javascript html

我在VS上的C#项目中使用外部HTML资源。为了填充网页,我将资源区域传递到c#代码中。但是,我希望将用户输入的输入传递给其他输入。示例区域如下所示:

!!!ThisIsSearchArea###
        <br>Customer Number <input type="text" name="customerNumber" id="customerNumber"><br>
        <br>Account Number  <input type="text" name="accountNumber" id="accountNumber"><br>

        <input name ="hiddenName" type="hidden" value="1" />
        <br>&nbsp<br><hr>

       <div>                  
    <a href="#" id="IntegrationSearchLink" data-action="IntegrationComponent_BC0625B6-7690-4CEA-8C42-B2C433FD5315">Search</a>
     <script type="text/javascript">
         $(document).ready(
        function () {
            $('#IntegrationContinueLink').hide();
            $('#IntegrationSearchLink').button();
            $('#IntegrationSearchLink').click(function (event) {
                $('#hidIntegrationCommand').val('SearchCustomers');
                ExecuteAction(event, $(this));
            });

        });

  

现在,我的所有网页上都存在此搜索区域,当javascript运行时,会显示新的网页。但是,当再次使用此区域时,我会丢失两个文本输入的输入值,并且它们是空白的。因此有没有办法使用javascript或其他代码保留这些值?

1 个答案:

答案 0 :(得分:1)

使用cookie,除此之外,与任何客户端脚本一样,您不可能这样做。

如果您使用的是php之类的任何服务器端语言,则可以将该值存储在会话变量中。

$_SESSION[]