开发者

Setting asp:Image URL using Javascript function

开发者 https://www.devze.com 2023-01-03 11:16 出处:网络
I have a series of asp:ImageButtons and one asp:Image(Big). Clicking on each ImageButton should change the ImageUrl of asp:Image to a new ImageUrl. How can we handle this using one Javascript function

I have a series of asp:ImageButtons and one asp:Image(Big). Clicking on each ImageButton should change the ImageUrl of asp:Image to a new ImageUrl. How can we handle this using one Javascript function. Because I dont wanna code ImageButton_Click for each and every asp:ImageButton. This makes my appl开发者_开发知识库ication run very slow and also pass too many server requests.

Any ideas ????How to design one powerful Javascript function. By the way when the user clicks on ImageButton...the ImageUrl that has to be set to asp:Image(Big) is same as that of ImageButton. This might help a bit.

Thanks in advance


Do a view source, your asp:image might be shown as img src=... when rendered as html.

You can use document.getElementById() to get the elements and based on the image button click, change their property like: e.g. imageNode = document.getElementById(id); imageNode.href= "google.com";

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号