Javascript wont change value in TextBox

Posted by mattgcon on Stack Overflow See other posts from Stack Overflow or by mattgcon
Published on 2011-01-10T00:45:59Z Indexed on 2011/01/10 0:54 UTC
Read the original article Hit count: 217

Filed under:
|
|

Here is my javascript

function AppendValues(e) {
    var lghtcnt = 0;
    var vars = e.id.split(';');
    var highcnt = false;
    var lghtid = "";
    var maxltcnt = 100;
    for (var x = 0; x < vars.length; x++) {
        var tokens = vars[x].split('|');
        var pram = tokens
        if (tokens[0] == "ID"){
            lghtid = tokens[1];
        }
        if (tokens[0] == "LTC"){
            var itemcnt = 0;
            var currentcnt = 0;
            currentcnt = parseInt(tokens[1].toString());
            var txtid = document.getElementById(vars[0] + ';' + vars[1] + ';' + vars[2] + ';' + vars[3] + ';' + vars[4]);
            if (e.checked)
            {
                totallightcnt += currentcnt;
                if (totallightcnt > maxltcnt)
                {
                    document.getElementById(vars[0] + ';' + vars[1] + ';' + vars[2] + ';' + vars[3] + ';' + vars[4]).value = 0;
                    alert('This puts you over the limit of 100 total lights, please make adjustments.');
                    break;
                }
                document.getElementById(vars[0] + ';' + vars[1] + ';' + vars[2] + ';' + vars[3] + ';' + vars[4]).value = currentcnt.toString();
            }
            else {
                totallightcnt -= currentcnt;
                document.getElementById(vars[0] + ';' + vars[1] + ';' + vars[2] + ';' + vars[3] + ';' + vars[4]).value = 0;
                break;
            }
        }
        if (highcnt)
        { break; }
    }
}

Here is the issue, when I check the value it DOES say theupdated value but it does not display to the user on the webpage. What could be the issue?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about textbox