function keyvaluepair()

in pysteve/www/htdocs/js/steve_rest.js [274:308]


function keyvaluepair(name, text, type, value, locked, onedit) {
    var obj = document.createElement('div')
    obj.setAttribute("class", "keyvaluepair");
    var txt = document.createElement('div');
    txt.setAttribute("class", "keyfield")
    txt.innerHTML = text
    obj.appendChild(txt)
    if (type == "text") {
        var input = document.createElement('input')
        input.setAttribute("id", name)
        input.value = value
        input.style.minWidth = "300px"
        obj.appendChild(input)
        if (locked) {
            input.setAttribute("readonly", "true")
            input.setAttribute("disabled", "true")
            input.style.background = "#999"
        }
        if (onedit) {
            input.setAttribute("onchange", onedit)
        }
    } else if (type == "textarea") {
        var input = document.createElement('textarea')
        input.setAttribute("id", name)
        input.value = value
        input.style.minWidth = "600px"
        input.style.minHeight = "250px"
        if (onedit) {
            input.setAttribute("onchange", onedit)
        }
        obj.appendChild(input)
    }
    
    return obj
}