我有一个显示来自 sql server 的图像的数据列表。在数据列表控件中我有
<asp:DataList ID="datalist1" runat="server" RepeatDirection="Horizontal"
RepeatColumns="3" CellPadding="1" CellSpacing="25" >
<ItemTemplate>
<table style="width:178px;">
<tr>
<td ID="img1">
<div id="smalldiv">
<img id="imgitem" src="allproducts.ashx?autoid=<%# Eval("AutoId").ToString() %>" onmouseover="zoomimg();" onmouseout="zoomout();" alt="" width="180px" height="220px"/>
<asp:Label id="lblprice" runat="server" Text='<%#"("+ Eval("Price").ToString() + " )"%>'></asp:Label>
<asp:HyperLink id="Linksml" runat="server" NavigateUrl="~/Presentation/home.aspx.cs">HyperLink</asp:HyperLink>
</div>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
它仅缩放第一张图像。
它的脚本
function zoomimg() {
document.getElementById('img1').style.border = "1px solid black";
//document.getElementById('bigdiv').style.display = "block";
}
function zoomout() {
document.getElementById('img1').style.border = "none";
// document.getElementById('bigdiv').style.display = "none"; }