4
Hello. I’m having problems with IE8, only in it, other browsers and different versions have been tested and worked, only in IE8 does not work.
I have a question page in YES/NO as I choose in radio buttons. Below a send button. When the user responds and clicks submit, play the questions with answers in the textarea. However, in IE8, do not accept the n in the textarea, so everything is in one line.
I’ve used \n
, \r\n
, \cr
and even the code ASCII 13
, and yet, IE8 doesn’t work. Someone could 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>
Post the HTML part, but as far as you can see
\n
is line breaking in text fields, with input and textarea, or element<pre>
, but in html the correct would be<br>
.– Guilherme Nascimento
See if this solution works: http://stackoverflow.com/questions/27263614/new-line-character-n-not-supported-in-ie-8-browser
– Filipe Tagliatti