#1
  1. No Profile Picture
    Contributing User
    ASP Explorer (0 - 99 posts)

    Join Date
    Jan 2014
    Posts
    67
    Rep Power
    4

    Javascript not firing


    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:

    ----------------------------------
    <aspropDownList 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" />
    </aspropDownList>

    <aspropDownList 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" />
    </aspropDownList>


    <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
  2. #2
  3. I do .NET for a living
    ASP Skiller (1500 - 1999 posts)

    Join Date
    Sep 2003
    Location
    Florida
    Posts
    1,558
    Rep Power
    214
    Is this in a stand-alone page or does the application have a master page?
    Roger (.NET MCP)

Similar Threads

  1. Replies: 0
    Last Post: March 11th, 2011, 06:00 PM
  2. Autocompelete not firing !!
    By kooly in forum .NET Development
    Replies: 5
    Last Post: May 30th, 2010, 02:19 PM
  3. HTML & JavaScript <fieldset> Stops javascript function working
    By icoombs in forum HTML, JavaScript And CSS Help
    Replies: 5
    Last Post: August 2nd, 2009, 02:06 PM
  4. Firing javascript from asp form
    By moris in forum ASP Development
    Replies: 9
    Last Post: February 13th, 2007, 12:55 AM
  5. ASP.NET : PostBack not firing after Javascript function.
    By ZylogZ80 in forum .NET Development
    Replies: 1
    Last Post: August 24th, 2005, 02:29 AM

IMN logo majestic logo threadwatch logo seochat tools logo