Access ASP.NET control using javascript
- by user3036965
I have a basic javascript function like this which works as I am able to dynamically change the textbox in a javascript method at runtime.
function MyTst(pVal2) {
var x = document.getElementById('<%=myImage.ClientID%>');
x.src = "/images/write.gif";
}
In the above code I need to be generic. So replace '<%=myImage.ClientID%' with the input param to my method which in this instance is called pVal2 and contains the asp.net server control image id.
Can anyone advise on an approach to do this. I've tried lots of things and just cant seem to get it working.
Thanks for any advice.