无法检索页面之间传递的值

时间:2013-10-22 09:19:58

标签: c# javascript jquery asp.net function

这就是我调用iframe并传递数据的方法

<script type="text/javascript">
         function refreshConversatio() {
             document.getElementById('iframeDisplayMessage').src = 'Message.aspx?id=' + document.getElementById('val').value;
             }
</script>

这就是我获得价值的方式,但我如何通过Hiddenfield接受价值?

<script type="text/javascript">
        function getParameterByName(name) {
            name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
            var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
                results = regex.exec(location.search);
            return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
        }
        function myLoad() {
            document.getElementById('divConversation').innerText = getParameterByName("id");
        }
    </script>
</head>
<body style="background-color:#a32c05;" >
       <input type="hidden" runat="server" id="hidden1" name="hidden1" />
    <div id="divConversation"></div>

    <script>
        myLoad();
    </script>
</body>

1 个答案:

答案 0 :(得分:0)

var hiddenId = document.getElementById('<%hidden1.ClientId%>');
hiddenId.value=getParameterByName("id");