且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用鼠标悬停在动态创建的按钮上显示图像弹出窗口

更新时间:2023-01-02 17:01:35

使用ajaxcontrol工具包,你有这个扩展控件来执行此操作


我在这里有样品



http://www.asp .net / ajaxlibrary / AjaxControlToolkitSampleSite / [ ^ ]






下载工具包




http://ajaxcontroltoolkit.codeplex.com/ [ ^ ]





玩得开心快乐


您可以使用 jQuery Dialog [ ^ ]。



动态创建按钮时,添加一个 CssClass 属性给它们并提供所有按钮共有的类名。



然后在 JavaScript 上,使用类选择器选择这些按钮并提高他们的 onmouseover 事件,并在活动内打开对话框。



查看一个示例 - 按钮上的打开jQuery模态弹出窗口在ASP.Net中 [ ^ ]。在此处打开按钮上的对话框单击并按ID选择按钮。您只需要通过类选择器替换它, onmouseover 点击事件。


I have a web application that creates buttons dynamically. It can create up to 120 buttons depending on the underlying database. I am looking for the best way to make a panel popup with an image of the product when the mouse hovers over the button for a few seconds. I thought about using the hover extender but after reading a few threads on performance issues I a mot sure if that will be the best solution. I am open to any suggestions to make this work. Thank you in advance for your time in answering my question.

use ajaxcontrol toolkit and u have this extension control to perform this


uve got sample here

http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/[^]


download the toolkit from


http://ajaxcontroltoolkit.codeplex.com/[^]


have fun happy week


You can use jQuery Dialog[^].

While creating Buttons dynamically, add one CssClass attribute to them and provide a class name common to all the Buttons.

Then on JavaScript, use class selector to select these Buttons and raise their onmouseover event and inside the event open the Dialog.

See one example - Open jQuery Modal Popup Window on Button Click in ASP.Net[^]. Here it opens the Dialog on Button Click and selects the Button by ID. You just need to replace that by class selector and click event by onmouseover.