خرید بک لینک
Hi guys

I am totally new to .net and need to update a page that was created by someone else.

Basically, I need the following to work:


Code:

                  <asp:DropDownList ID="minprice" runat="server" class="form-control" onchange="sum();">
                    <asp:ListItem Text="£0" Value="0" />
                    <asp:ListItem Text="£500" Value="500" />
                    <asp:ListItem Text="£1,000" Value="1000" />
                    <asp:ListItem Text="£2,000" Value="2000" />
                    <asp:ListItem Text="£3,000" Value="3000" />               
                  </asp:DropDownList>

                  <asp:DropDownList ID="maxprice" runat="server" class="form-control" onchange="sum();"
                    <asp:ListItem Text="£500" Value="500" />
                    <asp:ListItem Text="£1,000" Value="1000" />
                    <asp:ListItem Text="£2,000" Value="2000" />
                    <asp:ListItem Text="£3,000" Value="3000" />
                  </asp:DropDownList>


<asp:TextBox ID="newprice" runat="server" class="form-control" />


<script>
function sum() {
            var txtFirstNumberValue = document.getElementById('minprice').value;
            var txtSecondNumberValue = document.getElementById('maxprice').value;
            var result = parseInt(txtFirstNumberValue) + parseInt(txtSecondNumberValue);
            if (!isNaN(result)) {
                document.getElementById('newprice').value = result;
            }
        }
</script>


What should happen is that the "newprice" textbox should populate with the total of the "minprice" and "maxprice" fields. I'm just clutching at straws here.

Any help would be fully appreciated

Best regards

Rod from the UK

برچسب: نویسنده: آیلین رضوانی تاريخ: شنبه 18 شهريور 1396 ساعت: 4:26

صفحه بندی