.net с главной страницей как использовать переменную для поиска элемента управления на странице .aspx с помощью javascript
Hello... I am trying to use javascript document.getElementById() to find a server control on my page. The page uses a master page. The challenge is the control has a variable name. In this case, these are textboxes with IDs like customer_123, customer_654 The javascript function is passed a variable for each control like thisid I can always use something like document.getElementByID('ctl00_maincontent_customer' + thisid)).value But, I do not like using that hard-codes syntax and prefer to use document.getElementByID('<%=thiscontrolid.ClientID%>').value I cannot find a way to create the [thiscontrolid] as a variable whose value is partially passed to the function. For example. Something like: function getMyControl(thisid) { document.getElementByID("<%=customer_[thisid].ClientID%>").value } But I have not been able to find a syntax that will allow me to do this. Any suggestions would be appreciated. What I have tried: <pre>document.getElementByID("<%=customer_" & thisid.ClientID%>").value
Sarita Mall
Почему бы вам не использовать J-query вместо JavaScript?