问题
I am using asp.net 2.0 and c#.
I have a datagrid in which I have a image control, i.e.
<asp:Image ID="ImagePreview" runat="server" Width="62px" Height="62px" />
for which I am setting the image URL from code behind, i.e.the image exist in the physical folder. I want to open a pop up with the image on mousehover.
Please help me. Thanks in advance.
Kindly let me know if any other information is required.
回答1:
Please use JavaScript for this:
ImagePreview.Attributes.Item("onMouseOver") = "javascript:window.open('localhost','newWindow','width=200,height=200')";
回答2:
Try jQuery Tooltips, you can put the image preview in the tooltip. http://flowplayer.org/tools/tooltip/index.html
I've implemented this in a column in a GridView control and it works great
来源:https://stackoverflow.com/questions/3229134/pop-up-image-on-mouse-hover