<asp:DataList ID="DataList1" runat="server" Width="343px" RepeatColumns="8" Height="228px" OnItemCommand="DataList1_ItemCommand" DataKeyField="id" >
            <ItemTemplate>
                <table>
                    <tr>
                        <td style="width: 3px; height: 19px">
                            <img   id="images"  style="height:150px; "   src='<%# DataBinder.Eval(Container.DataItem,"picture") %>'  onclick=""/>
                    </tr>
              </table>
            </ItemTemplate>
        </asp:DataList>
我想在onclick直接写JS前台AJAX然后操作。 如何获得这个IMAGES的的下标,知道的麻烦告诉下谢谢,

解决方案 »

  1.   

    onclick = "getThis(this);"function getThis(obj)
    {
        obj.src="http://www.google.com.hk/intl/zh-CN/images/logo_cn.png";
    }
      

  2.   

     如何获得他的下标呢 因为还有别的控件里的东西要一起用 不是就一个IMG 就行了 
      

  3.   

    <tr>
                            <td class="label";style="width: 3px; height: 21px; text-align: center;">
     <asp:Label ID="Label1" runat="server" Text='' Width="149px"></asp:Label></td>
                        </tr>
    我想单击的时候能取出TEXT的值 怎么用 告诉下谢谢
      

  4.   

    js JS 遍历datalist
      

  5.   

    <img alt="" src="...."  onclick="test(<%#Container.ItemIndex %>)" />js:
            function test(no) {
                alert(no);
            }