با سلام .من دیتالیست رو پر می کنم حالا میخوام توسط یک دکمه به عناصر موجود در اون دسترسی داشته باشم البته از طریق جاوا اسکریپت.من کد رو گذاشتم .هر چه سعی کردم نتونستم .لطفا کمکم کنید.
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>Untitled Page</title>
<scripttype="text/javascript">
function show()
{
var p=document.getElementById('p1');
alert(p.value);
var p1=document.getElementById('lproducts');
alert(p1.innertext);
}
function show1()
{
var p1=document.getElementById('p1');
}
</script>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:DataListRepeatColumns="2"GridLines="Both"DataKeyField="Pk_id"Width="100%"
runat="server"ID="ListProducts"
>
<ItemTemplate>
<tabledir="rtl">
<tr>
<td>
<inputid="p1"runat="server"onclick="return show()"type="button"value='<%#bind("Product") %>'/>
<asp:LabelID="lproducts"Text="<%#bind('Product') %>"runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
<imgid="imgproduct"height="50"width="40"runat="server"src="<%#bind('Url') %>"alt="<%#bind('Product') %>"/>
</td>
</tr>
<tr>
<td>
<asp:LabelID="ltozihat"Text="<%#bind('Tozihat') %>"runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
قیمت : <asp:LabelID="lbl"Text="<%#bind('Price') %>"runat="server"></asp:Label>
<br/>
</td>
</tr>
<tr>
<td>
<td>
<buttonid="Button2"style="width:60"onclick="return show()"value="kharid">shoe data </button>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
</html>