datalist imagebuttom弹出对话框问题
<asp:DataListID="DataList1"runat="server"RepeatColumns="4"RepeatDirection="Horizontal...
<asp:DataList ID="DataList1" runat="server" RepeatColumns="4"
RepeatDirection="Horizontal" onitemcommand="DataList1_ItemCommand"
oneditcommand="DataList1_EditCommand" onitemdatabound="DataList1_ItemDataBound"
onselectedindexchanged="DataList1_SelectedIndexChanged"
DataKeyField="workid">
<ItemTemplate><div class="zpli">
<div class="zpimg"><br /><a href="workintro.aspx?id=<%# Eval("workid") %>"><img src="<%# Eval("picpath") %>" width="222" height="174" title="<%# Eval("workname") %>" /></a></div>
<div class="ps"><%# Eval("votes") %> 票</div>
<div class="zp_txt">作品类型:<%# Eval("type") %><br />
作品名称:<%# Eval("workname") %><br />
拍摄作者:<%# Eval("auther") %></div>
<div class="zp_tp">
<asp:ImageButton ID="ImageButton1" AlternateText="投票" ImageUrl="images/tp_bt.jpg" onclick="opendialog(<%# Eval("workid") %>)" runat="server" />
</div>
</div>
</ItemTemplate>
</asp:DataList>
function opendialog(id){
window.open('dialog.aspx?id='+id,'insertarticle', 'height=0, width=0, toolbar= no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no,top=0,left=0');
}
imagebuttom事件onclick报错为什么?
能写出具体怎么实现吗 展开
RepeatDirection="Horizontal" onitemcommand="DataList1_ItemCommand"
oneditcommand="DataList1_EditCommand" onitemdatabound="DataList1_ItemDataBound"
onselectedindexchanged="DataList1_SelectedIndexChanged"
DataKeyField="workid">
<ItemTemplate><div class="zpli">
<div class="zpimg"><br /><a href="workintro.aspx?id=<%# Eval("workid") %>"><img src="<%# Eval("picpath") %>" width="222" height="174" title="<%# Eval("workname") %>" /></a></div>
<div class="ps"><%# Eval("votes") %> 票</div>
<div class="zp_txt">作品类型:<%# Eval("type") %><br />
作品名称:<%# Eval("workname") %><br />
拍摄作者:<%# Eval("auther") %></div>
<div class="zp_tp">
<asp:ImageButton ID="ImageButton1" AlternateText="投票" ImageUrl="images/tp_bt.jpg" onclick="opendialog(<%# Eval("workid") %>)" runat="server" />
</div>
</div>
</ItemTemplate>
</asp:DataList>
function opendialog(id){
window.open('dialog.aspx?id='+id,'insertarticle', 'height=0, width=0, toolbar= no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no,top=0,left=0');
}
imagebuttom事件onclick报错为什么?
能写出具体怎么实现吗 展开
1个回答
展开全部
onclick="opendialog(<%# Eval("workid") %>)"这个不是JavaScript事件
加上
function opendialog(id){
window.open('dialog.aspx?id='+id,'insertarticle', 'height=0, width=0, toolbar= no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no,top=0,left=0');
}这部分要经行声明,声明是JavaScript代码
加上
function opendialog(id){
window.open('dialog.aspx?id='+id,'insertarticle', 'height=0, width=0, toolbar= no, menubar=no, scrollbars=yes, resizable=no, location=no, status=no,top=0,left=0');
}这部分要经行声明,声明是JavaScript代码
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询