我试图将文本框的clientid传递给javascript函数。出于某种原因,当我使用document.getElementById时,它返回null。请帮忙
function incNumber(textId){
var id = textId
var test = document.getElementById(textId);
var c = parseInt(document.getElementById(id).value);
var res = isNaN(c)
if (res) {
c = 0;
}
else {
c++;
}
document.getElementById(textId).value = c;
}
<asp:TextBox ID="pointVal" runat="server"></asp:TextBox>
<asp:Button runat="server" Text="Increase" ID="inc" OnClientClick="javascript:incNumber('<%= pointVal.ClientID %>'); return false;" />