将3个文本框参数从ASPX传递到javascript函数 [英] Passing 3 textbox parameters to a javascript function from ASPX
本文介绍了将3个文本框参数从ASPX传递到javascript函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的所有人,
我想将三个文本框值传递给javascript函数。然而它不工作。非常感谢任何帮助。
我尝试过:
Dear All,
I want to pass three textbox values to a javascript function. However its not working.Any help is really appreciated.
What I have tried:
<asp:ImageButton ID="ibut_cheque2" runat="server" target="_blank" OnClientClick='<%# string.Format("window.open(\"Product.aspx?pid=\" + document.getElementById(\"{0}\").value & chdate=\" + document.getElementById(\"{1}\").value & pname=\" + document.getElementById(\"{2}\").value, null,\"scrollbars=yes,top=10,left=10\", \"true\");", Form.FindControl("txt_voucher").ClientID,Form.FindControl("txtbox_chqdate").ClientID,Form.FindControl("txtbox_chprovider").ClientID)%>'
AlternateText="Print" CssClass="btn5" ForeColor="White" ToolTip="Print Cheque" />
推荐答案
通过放置它来简化它函数中的代码
Simplify it by placing the code in a function
<script>
function openWindow() {
var pid = document.getElementById('<%=txt_voucher.ClientID %>');
var chdate = document.getElementById('<%=txtbox_chqdate.ClientID %>');
var pname = document.getElementById('<%=txtbox_chprovider.ClientID %>');
window.open("Product.aspx?pid=" + pid + "chdate= " + chdate + " & pname= " + pname + ", null,scrollbars=yes,top=10,left=10", "true");
}
</script>
<asp:ImageButton ID="ibut_cheque2" runat="server" target="_blank" OnClientClick='openWindow()' AlternateText="Print" CssClass="btn5" ForeColor="White" ToolTip="Print Cheque" />
这篇关于将3个文本框参数从ASPX传递到javascript函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文