我想在datalist图像的鼠标悬停事件上更改图像 [英] i would like to change image on mouseover event of a datalist image
问题描述
< asp:DataList ID =DataList6runat =serverRepeatDirection =Vertical>
< itemtemplate>
< asp:Image ID =Image1runat =server
Height =62pxWidth =82pxImageUrl ='<%#Bind(main_image)% >'/>
< asp:图片ID =完整图片runat =serverHeight =450pxWidth =350pxImageUrl =a.jpg/>
在这里,我会要在'image1'鼠标悬停事件中将'完整图像'图像转换为'image1'图像,请提供有用的代码。
我建议您使用Jquery
在鼠标悬停时更改图像
http: //jquery.com/download/ [ ^ ]
将以下所有代码放在脚本标记内。
首先拍摄图像的路径,如下图所示。
var Imagesrc =
(' #Image1')。attr( src);
现在使用该变量来分配另一个图像的来源,如如下所示。
<asp:DataList ID="DataList6" runat="server" RepeatDirection="Vertical">
<itemtemplate>
<asp:Image ID="Image1" runat="server"
Height="62px" Width="82px" ImageUrl='<%# Bind("main_image") %>'/>
<asp:Image ID="full image" runat="server" Height="450px" Width="350px" ImageUrl="a.jpg"/>
Here , i would to convert 'full image' imageurl to 'image1' imageurl on 'image1' mouseover event, please provide me with useful code.
解决方案 i suggest you to use Jquery
changing image on mouseover
Hi, you may either use JavaScript or JQuery. I have shown using JQuery. Place JQuery(.JS) file in the page when you have to use it. If you don't have .JS file than download from below code.
http://jquery.com/download/[^]
Place all below code within script tag.
First take the path of the image, such as below.
var Imagesrc =
('#Image1').attr("src");
Now use that variable to assign the source of the another image, as shown below.
这篇关于我想在datalist图像的鼠标悬停事件上更改图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!