Hi everyone,
I wrote some JS. I have an asp-imagebutton (within a formview)and js-function. On mouseover of the button the function will be called and it will get the src from the imagebutton. All works ok. But how could I pass the control dynamically into the function and then take its src (ImageUrl) so i can call it from any imagebutton?
Pampers
Keeping it simple can be complicated
I wrote some JS. I have an asp-imagebutton (within a formview)and js-function. On mouseover of the button the function will be called and it will get the src from the imagebutton. All works ok. But how could I pass the control dynamically into the function and then take its src (ImageUrl) so i can call it from any imagebutton?
Code:
<asp:ImageButton ID="ImageButton1" runat="server" Height="60px" ImageUrl='<%#Eval("ApartmentPhotoPath")%>'
Width="90px" onmouseover="showPhoto1()" />
<script language="javascript" type="text/javascript">
<!--
function showPhoto1()
{
var imgOrg = document.getElementById('<%=FormView3.FindControl("ImageButton1").ClientID%>')
var strPath = imgOrg.src
var imgTest2 = document.getElementById("imgBigImage")
imgTest2.src = strPath
}
-->
</script>
Pampers
Keeping it simple can be complicated