假设我有一个DevExpress ASPxTextBox,其id为"instrument".我想访问客户端文本框的值.所以我需要写一个javascript.
如果它是一个普通的asp文本框,我可以通过编写代码来访问文本框var instrumentElement = document.getElementById('<%=instrument.ClientID%>')
但是同样的方法对DevExpress的文本框不起作用.
如何访问ASPxTextBox?我使用的是Developer Express版本7.2.
这是一些更全面的代码片段 -
<div style="display: inline; float: left;">
<dxe:ASPxTextBox ID="InstrumentQuantity" runat="server" Width="170px">
</dxe:ASPxTextBox>
</div>
<div style="display: inline; float: left;" onclick="incOrDecQty(0);">
<asp:ImageButton ID="decrementQuantity" runat="server"
Height="16px" Width="16px" ImageUrl="~/images/left.png"
AlternateText="Decrease Quantity" PostBackUrl="javascript:void(0);"/>
</div>
<div onclick="incOrDecQty(1);">
<asp:ImageButton ID="incrementQuantity" runat="server"
AlternateText="Increase Quantity" ImageUrl="~/images/right.png"
Height="16px" Width="16px" PostBackUrl="javascript:void(0);" />
</div>
Run Code Online (Sandbox Code Playgroud)
这就是ASP代码.相应的Javascript如下:
function incOrDecQty()
{
var element = document.getElementById('<%=InstrumentQuantity.ClientID%>');
var lotSize = parseInt(document.getElementById('<%=LotSize.ClientID%>')
.innerHTML, 10);
var currentValue = parseInt(element.value,10);
if(arguments[0] == 1)
currentValue += lotSize;
else if((currentValue - lotSize) …Run Code Online (Sandbox Code Playgroud)