This code is supposed to return a string from an input, written the other way around but it doesn't work... Can someone help me?
function Change1() {
document.getElementById("top").innerHTML="Inroduceti cuvantul";
document.getElemenyById("button1").setAttribute('onclick','StringBackFlip(document.getElementById("insert").value)');
}
function StringBackFlip(str) {
var res = "";
var i = str.lenght;
while (i>0) {
res += str[i-1];
i--;
}
document.getElementById("result").value=res;
document.getElementById("top").innerHTML="Introduceti alt cuvant";
}
This is the code. I need help so tell me what I've done wrong.