Hello. I'm having problems with IE8, only in it, other browsers and different versions have already been tested and worked, only IE8 does not work.
I have a question page in YES / NO as a choice on radio buttons. Underneath a submit button. When the user responds and clicks send, plays the questions with answers in the textarea. However, in IE8, it does not comply with the \ n in textarea, so it's all in one line.
I have already used \n
, \r\n
, \cr
and even the ASCII 13
code, and even then IE8 does not work. Could someone help me?
<script>
function PreencherCampo(){
var procn1 = document.getElementById("procn1").innerHTML;
var pergunta1 = document.getElementById("pergunta1").innerHTML;
var pergunta2 = document.getElementById("pergunta2").innerHTML;
var pergunta3 = document.getElementById("pergunta3").innerHTML;
var procfield = document.getElementById("procfield").innerHTML;
var pecsug = document.getElementById("pecsug").innerHTML;
var elementos1 = document.getElementsByName('pergunta1');
var resposta1 = '';
for (i = 0; i < elementos1.length; i++) {
if (elementos1[i].checked) {
resposta1 = elementos1[i].value;
}
}
var elementos2 = document.getElementsByName('pergunta2');
var resposta2 = '';
for (i = 0; i < elementos2.length; i++) {
if (elementos2[i].checked) {
resposta2 = elementos2[i].value;
}
}
var elementos3 = document.getElementsByName('pergunta3');
var resposta3 = '';
for (i = 0; i < elementos3.length; i++) {
if (elementos3[i].checked) {
resposta3 = elementos3[i].value;
}
}
document.getElementById("resposta").innerHTML = procn1 + '\r\n'+
pergunta1 + ': ' + resposta1 + '\r\n'+
pergunta2 + ': ' + resposta2 + '\r\n'+
pergunta3 + ': ' + resposta3 + '\r\n\n'+
procfield + '\r\n'+
pecsug;
}
</script>