Ho questo codice che, quando richiamato, stampa un form HTML, precedentemente associato alla variabile form in un div che si chiama divForm.

codice:
function miaFunzione(){
    var form, ris;

    form = "<form action=\"#\" >testo

";
    form += "<input type=\"text\" name=\"valore\" value=\"valore\" onkeyup=\"ris = this.value\" />";
    form += "<input type=\"submit\" name=\"act\" value=\"Invia\" >";
    form += "variabile: "+ris;
    form += "</form>";

    var target = document.getElementById("divForm");
    target.innerHTML=form;

}
Quello che vorrei ottenere è che ogni volta che scrivo un carattere nell' input del form venga aggiornata la variabile ris. Ma questo non avviene ed è sempre stampato:
variabile: undefined
Qualcuno saprebbe aiutarmi?