button.attributes.add无法正常工作 [英] button.attributes.add not working properly

查看:156
本文介绍了button.attributes.add无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我遇到了ASP.Net中客户端脚本编写的问题.我添加了以下代码,用于在客户端显示图像并在服务器端显示图像的按钮:

Hi,

I''m running through a problem of client side scripting in ASP.Net. I''ve following code added for a button to show up and image on client side and go up server side:

btnSearch.Attributes.Add("onclick", "document.getElementById(''preloaderImage'').style.visibility=''visible'';");


这工作正常,但仅当我第一次单击按钮时才有效,而第二次或再次单击时则不然.感谢您的帮助!!

最好的问候,
Sunny.


This is working fine but only when I click the button first time, not on second and further clicks. I appreciate any help !!

Best regards,
Sunny.

推荐答案

您不能在ASPX页面上为按钮添加JavaScript.

这样一来,您就无需担心在后台代码上添加属性.

您也可以在document.ready上编写J-Query,将在页面完全加载后执行该查询,以便隐藏图像,
Can''t you add javascript on ASPX page for button.

That way you will not need to think worry adding attribute on code-behind.

Also you can write J-Query on document.ready which will be executed once page is loaded fully so you can hide the image,


这篇关于button.attributes.add无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆