<asp:DataList ID="DataList1" runat="server"
Height="150px" RepeatDirection="Horizontal" Width="701px">
<ItemTemplate>
<a id="various3" href="Details.aspx?pid=<%# Eval("Pid") %>" onfocus="this.blur();">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Bind("Pimage") %>'/></a>
<br />
<asp:Label ID="Label1" runat="server" Text="型号:"></asp:Label>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Pnumber") %>'></asp:Label>
</ItemTemplate>
</asp:DataList>调用的是various3 只有第一张图片有效果能弹出层
Height="150px" RepeatDirection="Horizontal" Width="701px">
<ItemTemplate>
<a id="various3" href="Details.aspx?pid=<%# Eval("Pid") %>" onfocus="this.blur();">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Bind("Pimage") %>'/></a>
<br />
<asp:Label ID="Label1" runat="server" Text="型号:"></asp:Label>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Pnumber") %>'></asp:Label>
</ItemTemplate>
</asp:DataList>调用的是various3 只有第一张图片有效果能弹出层
myImage.Attributes.Add("onfocus", "this.blur();"
即可
可是我第一张图片有效果啊
<a id="various3" href="Details.aspx?pid=<%# Eval("Pid") %>" onfocus="this.blur();">
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Bind("Pimage") %>'/></a>
理论上应该全部图片都应该有效果的啊 想不通啊 这js是网上下的 用的是静态
<script type="text/javascript">
$(document).ready(function() {
$("#various3").fancybox({
'width' : '75%',
'height' : '75%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
});
</script> 这个是页面上的 其他的是外部链接
$(document).ready(function() {
$("#DataList1 a").each(function(){
$(this).fancybox({
'width' : '75%',
'height' : '75%',
'autoScale' : false,
'transitionIn' : 'none',
'transitionOut' : 'none',
'type' : 'iframe'
});
});
});
</script> 试试这个 (DataList1=客户端显示的ID)
太厉害了 居然行了 太谢谢了
$("#DataList1 a").each(function(){
这个是怎么回事 这么神奇
哈哈 你看看jq api就知道了