我有如下所示的代码
<asp:TemplateField FooterStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
HeaderStyle-CssClass="Column1">
<ItemTemplate>
<div class="Column1" style="visibility:<%# SetEditImagesVisibility()%>;">
<img src="" id="iEdit" alt="Edit" class='btntransparent' onclick="EditQC('<%#Eval("ID") %>')" />
<img src="" id="iDelete" alt="Delete" class='btntransparent' onclick="DeleteQ('<%#Eval("ID") %>')" />
</div>
</ItemTemplate>
<HeaderTemplate>
<div style="visibility:<%# SetAddImagesVisibility()%>;">
<img src="" alt="Add" class='btntransparent' id="iPlus" runat="server" onclick="AddTestingID()" />
</div>
</HeaderTemplate>
</asp:TemplateField>
在这里,我需要在 javascript(iEdit 和 iDelete)中访问 img 标签 ID,但由于服务器标签未明确定义而出现错误 javascript 代码如下所示
document.getElementsById('iEdit').src = HostedPath + 'pics/edit.gif';
document.getElementsById('iDelete').src = HostedPath + 'pics/edit.gif';
任何人请帮我解决这个问题。提前致谢