Access ASP.NET control using javascript

Posted by user3036965 on Stack Overflow See other posts from Stack Overflow or by user3036965
Published on 2014-05-28T15:00:27Z Indexed on 2014/05/28 15:26 UTC
Read the original article Hit count: 191

Filed under:
|
|

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.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET