c# - 图像控件的 OnLoad 客户端事件

标签 c# javascript asp.net .net onload

我需要将客户端 onLoad 事件与 ASP.Net Image 控件绑定(bind)。我已经尝试了一段时间,但没有成功。

函数名称onload="onLoadFunction(this)"

脚本:

function onLoadFunction(img) {
     $(img).css("visibility", "visible"); // Using jQuery
     // img.style.visibility = "visible"; // Using just javascript.
 }

标记:

<asp:Image ID="imgTopFourImg2" runat="server" width="170px" height="112px" CssClass="ArticleImgHP" border="0" ImageUrl="hello.jpg" OnLoad="onLoadFunction(this)" />

这对我不起作用,如果有人可以帮助我,我将不胜感激。

最佳答案

$("img #xyz").bind("load", function () { $(this).css("visibility", "visible"); });

关于c# - 图像控件的 OnLoad 客户端事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10229625/

相关文章:

c# - 为什么我的 Azure AD 身份验证在登录时显示 "The system cannot find the file specified"错误?

c# - 如何导出 C# 方法?

javascript - Web Components 中的路径是相对于 Root 的

c# - 使用组合框导出/导入到 Excel

c# - 在属性和方法之间共享角色属性的初始化

c# - 如何编写一个 EF 查询来连接三个表并按字段排序?

javascript - jQuery - 如何组合多个点击操作

javascript - 在 javascript 中搜索和更新嵌套对象

javascript - 脚本访问内联 JavaScript 变量

asp.net - 在数据库中存储的图像在 asp.net 中受到干扰