传递一个查询字符串值我需要通过使用window.open将存储在一个ASP隐藏字段中的传递值传递给查询字符串。通过javascript window.open
onclick="window.open('../New/FeedbackV4.aspx','FeedbackWindow','width=960,height=640,scrollbars=yes,resizable=yes,status=yes')"
我需要的隐藏字段的值,并把它作为查询字符串
传递一个查询字符串值我需要通过使用window.open将存储在一个ASP隐藏字段中的传递值传递给查询字符串。通过javascript window.open
onclick="window.open('../New/FeedbackV4.aspx','FeedbackWindow','width=960,height=640,scrollbars=yes,resizable=yes,status=yes')"
我需要的隐藏字段的值,并把它作为查询字符串
我不知道我很了解情况,但由于一个HiddenField
:
<asp:HiddenField ID="hf_myhiddenfield" runat="server" Value="hidden value"/>
您可以使用JavaScript函数值插入到你的onclick
属性
的onclick
onclick="window.open('../New/FeedbackV4.aspx'+GetHFValue(),'FeedbackWindow','width=960,height=640,scrollbars=yes,resizable=yes,status=yes')"
Javascript
<script type="text/javascript">
function GetHFValue() {
var hf_value = '?' + document.getElementById("<%= hf_myhiddenfield.ClientID %>").value;
return hf_value;
}
</script>
这似乎确定...谢谢 – Joshua 2012-01-17 11:20:29
假设为简单起见,该隐藏字段有一个id
属性,说id='foo'
(如果没有,你需要找到拿起该元素)的另一种方法,使用
onclick="window.open('../New/FeedbackV4.aspx?' + par('foo'), ..."
(注意添加“?”)
与
<script>
function par(elid) {
var elem = document.getElementById(elid);
return encodeURI(elem.name) + '=' + encodeURI(elem.value);
}
</script>
你的问题是? – 2012-01-17 10:51:43
oops ...我需要获取隐藏字段的值并将其作为查询字符串传递。 – Joshua 2012-01-17 10:54:02