使用JS向Repeater中的TEXT控件斌值,该怎么解决
使用JS向Repeater中的TEXT控件斌值
------解决方案--------------------
document.getElementById('PayPrice'+i).value=obj;
你右键查看源代码看一下ID 是不是已经变了!
看是否可以用 PayPrice.ClientID
- C# code
function addshow(obj) { var count= parseInt("<%=this.Repeater1.Items.Count%>") for (var i=0;i<count;i++) { document.getElementById('PayPrice'+i).value=obj; } } <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <tr> <td align="left" background="../IMG/Order_bg_2.gif" ><asp:TextBox ID="PayPrice" runat="server" Width="9px" Text='<%#Convert.ToDouble(Eval("Price").ToString()).ToString("N0")%>'></asp:TextBox></td> </tr> </ItemTemplate> </asp:Repeater> obj的值变动时无法传到Repeater1控件里面的PayPrice.text里面。
------解决方案--------------------
document.getElementById('PayPrice'+i).value=obj;
你右键查看源代码看一下ID 是不是已经变了!
看是否可以用 PayPrice.ClientID