将隐藏字段值传递给javascript(href)

将隐藏字段值传递给javascript(href),javascript,asp.net,Javascript,Asp.net,我正在使用javascript做href。代码如下所示 <script> window.onunload = refreshParent; function refreshParent() { var SAPno = document.getElementById('HiddenNo'); window.opener.location.href="Inventory.aspx?" + "SAPNo="+ SAPno +; }

我正在使用javascript做href。代码如下所示

 <script>
    window.onunload = refreshParent;
    function refreshParent() {
        var SAPno = document.getElementById('HiddenNo');
        window.opener.location.href="Inventory.aspx?" + "SAPNo="+ SAPno +;
    }
</script>
    <asp:HiddenField ID="HiddenNo" runat="server" />

window.onunload=refreshParent;
函数refreshParent(){
var SAPno=document.getElementById('HiddenNo');
window.opener.location.href=“Inventory.aspx?”+“SAPNo=“+SAPNo+”;
}
我的隐藏字段代码如下所示

 <script>
    window.onunload = refreshParent;
    function refreshParent() {
        var SAPno = document.getElementById('HiddenNo');
        window.opener.location.href="Inventory.aspx?" + "SAPNo="+ SAPno +;
    }
</script>
    <asp:HiddenField ID="HiddenNo" runat="server" />

我可以知道如何使用hiddenfield中的值并传递到Inventory.aspx吗?有人知道如何检索值吗


谢谢

隐藏字段可以出现在任何表单提交中,其在表单提交时的值将与表单中的任何其他值一样包含在发送到服务器的表单数据中。在服务器端,检索它们的方式与检索任何其他表单的方式相同。客户端,您给它们一个值,就像任何其他表单字段都有一个值一样。唯一的区别是它们对最终用户不可见。它们是不显示的常规表单字段。注意:配备弹出窗口阻止程序的浏览器将忽略onunload事件处理程序函数中的所有window.open()方法调用。看见
<script> 
   window.onunload = refreshParent; 
   function refreshParent() { 
     var SAPno = document.getElementById('HiddenNo').value;   
     window.opener.location.href="Inventory.aspx?" + "SAPNo="+ SAPno
   } 
</script>