PROBLEMA CON UN ARRAY
Publicado por Alberto Sil (2 intervenciones) el 17/01/2021 20:04:30
Hola, tengo un archivo de texto 1-2.txt y lo meto en un array "chat", la posicion 0 y 4 del array tienen la misma palabra, pero la posicion [4] del array no reconoce la igualdad y no imprime el string en la celda. la posicion [0] si la reconoce. Alguien sabe porque pasa esto?.
Archivo 1-2.txt
LUZ:|
Hola, como estas?|
BETO:|
Bien, gracias.|
LUZ:|
Como te fue en tu trabajo|
BETO:|
Pues regular, pero todo bien, sin novedades.|
Este es el codigo:
Archivo 1-2.txt
LUZ:|
Hola, como estas?|
BETO:|
Bien, gracias.|
LUZ:|
Como te fue en tu trabajo|
BETO:|
Pues regular, pero todo bien, sin novedades.|
Este es el codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<script type="text/javascript">
<!--
function inicio(){
var chat = new Array();
$.ajax({
type: "GET", async: false, url: 'chats/1-2.txt', dataType: 'html',
success: function(msg){chat = msg.split('|'); die;}
});
if (chat[0] == "LUZ:"){document.getElementById("0").innerHTML= chat[0];};
if (chat[4] == "LUZ:"){document.getElementById("4").innerHTML= chat[4];};
}
-->
</script>
Valora esta pregunta
0