Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/11/2013, 20:57
Avatar de Crishe
Crishe
 
Fecha de Ingreso: noviembre-2013
Ubicación: España
Mensajes: 2
Antigüedad: 10 años, 5 meses
Puntos: 0
Pregunta ¿Me ayudan con este script?

Buenas a todos, bueno lo primero he de decir que empecé hace muy poco a programar en javascript y bueno, tengo una radio en la que quiero que salga a cada momento a qué DJ le toca emitir, esto solo lo puedo conseguir haciendo un horario como vais a ver a continuación en el script.

El problema es que el texto se muestra repetidamente uno detrás de otro por que está hecho con "document.write" y al utilizar setTimeout("directo()",1000) pasa eso... cada segundo se pone el texto detrás de otro, podéis comprobarlo vosotros mismos.. y bien, dicho esto... mi pregunta es: ¿Como puedo hacer para que no se muestre el texto detrás de otro?.

Aquí el script:
(Faltan los días sábado y domingo por que no me cabe para postear, así que los quité)

Código HTML:
<html>
<head>
</head>
<body>
<body onload="directo()">
<SCRIPT LANGUAGE="JavaScript"> 

function directo(){ 
var date = new Date()
var day = date.getDay()
var hr = date.getHours()

// Lunes
if ((hr == 1) && (day == 1)) document.write("AutoDJ")
if ((hr == 2) && (day == 1)) document.write("AutoDJ")
if ((hr == 3) && (day == 1)) document.write("AutoDJ")
if ((hr == 4) && (day == 1)) document.write("AutoDJ")
if ((hr == 5) && (day == 1)) document.write("AutoDJ")
if ((hr == 6) && (day == 1)) document.write("AutoDJ")
if ((hr == 7) && (day == 1)) document.write("AutoDJ")
if ((hr == 8) && (day == 1)) document.write("AutoDJ")
if ((hr == 9) && (day == 1)) document.write("AutoDJ")
if ((hr == 10) && (day == 1)) document.write("AutoDJ")
if ((hr == 11) && (day == 1)) document.write("AutoDJ")
if ((hr == 12) && (day == 1)) document.write("AutoDJ")
if ((hr == 13) && (day == 1)) document.write("AutoDJ")
if ((hr == 14) && (day == 1)) document.write("AutoDJ")
if ((hr == 15) && (day == 1)) document.write("AutoDJ")
if ((hr == 16) && (day == 1)) document.write("AutoDJ")
if ((hr == 17) && (day == 1)) document.write("AutoDJ")
if ((hr == 18) && (day == 1)) document.write("AutoDJ")
if ((hr == 19) && (day == 1)) document.write("Miguel Electrico")
if ((hr == 20) && (day == 1)) document.write("Nachek Dj")
if ((hr == 21) && (day == 1)) document.write("AutoDJ")
if ((hr == 22) && (day == 1)) document.write("AutoDJ")
if ((hr == 23) && (day == 1)) document.write("AutoDJ")
if ((hr == 0) && (day == 1)) document.write("AutoDJ")

// Martes
if ((hr == 1) && (day == 2)) document.write("AutoDJ")
if ((hr == 2) && (day == 2)) document.write("AutoDJ")
if ((hr == 3) && (day == 2)) document.write("AutoDJ")
if ((hr == 4) && (day == 2)) document.write("AutoDJ")
if ((hr == 5) && (day == 2)) document.write("AutoDJ")
if ((hr == 6) && (day == 2)) document.write("AutoDJ")
if ((hr == 7) && (day == 2)) document.write("AutoDJ")
if ((hr == 8) && (day == 2)) document.write("AutoDJ")
if ((hr == 9) && (day == 2)) document.write("AutoDJ")
if ((hr == 10) && (day == 2)) document.write("AutoDJ")
if ((hr == 11) && (day == 2)) document.write("AutoDJ")
if ((hr == 12) && (day == 2)) document.write("AutoDJ")
if ((hr == 13) && (day == 2)) document.write("AutoDJ")
if ((hr == 14) && (day == 2)) document.write("AutoDJ")
if ((hr == 15) && (day == 2)) document.write("AutoDJ")
if ((hr == 16) && (day == 2)) document.write("AutoDJ")
if ((hr == 17) && (day == 2)) document.write("AutoDJ")
if ((hr == 18) && (day == 2)) document.write("Dj Motoloco")
if ((hr == 19) && (day == 2)) document.write("AutoDJ")
if ((hr == 20) && (day == 2)) document.write("AutoDJ")
if ((hr == 21) && (day == 2)) document.write("AutoDJ")
if ((hr == 22) && (day == 2)) document.write("AutoDJ")
if ((hr == 23) && (day == 2)) document.write("AutoDJ")
if ((hr == 0) && (day == 2)) document.write("AutoDJ")

// Miercoles
if ((hr == 1) && (day == 3)) document.write("AutoDJ")
if ((hr == 2) && (day == 3)) document.write("AutoDJ")
if ((hr == 3) && (day == 3)) document.write("AutoDJ")
if ((hr == 4) && (day == 3)) document.write("AutoDJ")
if ((hr == 5) && (day == 3)) document.write("AutoDJ")
if ((hr == 6) && (day == 3)) document.write("AutoDJ")
if ((hr == 7) && (day == 3)) document.write("AutoDJ")
if ((hr == 8) && (day == 3)) document.write("AutoDJ")
if ((hr == 9) && (day == 3)) document.write("AutoDJ")
if ((hr == 10) && (day == 3)) document.write("AutoDJ")
if ((hr == 11) && (day == 3)) document.write("AutoDJ")
if ((hr == 12) && (day == 3)) document.write("AutoDJ")
if ((hr == 13) && (day == 3)) document.write("AutoDJ")
if ((hr == 14) && (day == 3)) document.write("AutoDJ")
if ((hr == 15) && (day == 3)) document.write("AutoDJ")
if ((hr == 16) && (day == 3)) document.write("AutoDJ")
if ((hr == 17) && (day == 3)) document.write("AutoDJ")
if ((hr == 18) && (day == 3)) document.write("Dj Motoloco")
if ((hr == 19) && (day == 3)) document.write("Miguel Electrico")
if ((hr == 20) && (day == 3)) document.write("Nachek Dj")
if ((hr == 21) && (day == 3)) document.write("AutoDJ")
if ((hr == 22) && (day == 3)) document.write("AutoDJ")
if ((hr == 23) && (day == 3)) document.write("AutoDJ")
if ((hr == 0) && (day == 3)) document.write("AutoDJ")

// Jueves
if ((hr == 1) && (day == 4)) document.write("AutoDJ")
if ((hr == 2) && (day == 4)) document.write("AutoDJ")
if ((hr == 3) && (day == 4)) document.write("AutoDJ")
if ((hr == 4) && (day == 4)) document.write("AutoDJ")
if ((hr == 5) && (day == 4)) document.write("AutoDJ")
if ((hr == 6) && (day == 4)) document.write("AutoDJ")
if ((hr == 7) && (day == 4)) document.write("AutoDJ")
if ((hr == 8) && (day == 4)) document.write("AutoDJ")
if ((hr == 9) && (day == 4)) document.write("AutoDJ")
if ((hr == 10) && (day == 4)) document.write("AutoDJ")
if ((hr == 11) && (day == 4)) document.write("AutoDJ")
if ((hr == 12) && (day == 4)) document.write("AutoDJ")
if ((hr == 13) && (day == 4)) document.write("AutoDJ")
if ((hr == 14) && (day == 4)) document.write("AutoDJ")
if ((hr == 15) && (day == 4)) document.write("AutoDJ")
if ((hr == 16) && (day == 4)) document.write("AutoDJ")
if ((hr == 17) && (day == 4)) document.write("Dj Sistern & Dj Piranha")
if ((hr == 18) && (day == 4)) document.write("Dj Motoloco")
if ((hr == 19) && (day == 4)) document.write("Miguel Electrico")
if ((hr == 20) && (day == 4)) document.write("AutoDJ")
if ((hr == 21) && (day == 4)) document.write("AutoDJ")
if ((hr == 22) && (day == 4)) document.write("AutoDJ")
if ((hr == 23) && (day == 4)) document.write("AutoDJ")
if ((hr == 0) && (day == 4)) document.write("AutoDJ")

// Viernes
if ((hr == 1) && (day == 5)) document.write("AutoDJ")
if ((hr == 2) && (day == 5)) document.write("AutoDJ")
if ((hr == 3) && (day == 5)) document.write("AutoDJ")
if ((hr == 4) && (day == 5)) document.write("AutoDJ")
if ((hr == 5) && (day == 5)) document.write("AutoDJ")
if ((hr == 6) && (day == 5)) document.write("AutoDJ")
if ((hr == 7) && (day == 5)) document.write("AutoDJ")
if ((hr == 8) && (day == 5)) document.write("AutoDJ")
if ((hr == 9) && (day == 5)) document.write("AutoDJ")
if ((hr == 10) && (day == 5)) document.write("AutoDJ")
if ((hr == 11) && (day == 5)) document.write("AutoDJ")
if ((hr == 12) && (day == 5)) document.write("AutoDJ")
if ((hr == 13) && (day == 5)) document.write("AutoDJ")
if ((hr == 14) && (day == 5)) document.write("AutoDJ")
if ((hr == 15) && (day == 5)) document.write("AutoDJ")
if ((hr == 16) && (day == 5)) document.write("AutoDJ")
if ((hr == 17) && (day == 5)) document.write("AutoDJ")
if ((hr == 18) && (day == 5)) document.write("Miguel Electrico")
if ((hr == 19) && (day == 5)) document.write("AutoDJ")
if ((hr == 20) && (day == 5)) document.write("Airon Diaz")
if ((hr == 21) && (day == 5)) document.write("SoundFactory")
if ((hr == 22) && (day == 5)) document.write("AutoDJ")
if ((hr == 23) && (day == 5)) document.write("AutoDJ")
if ((hr == 0) && (day == 5)) document.write("AutoDJ")
setTimeout("directo()",1000)
}
</SCRIPT>

</body>
</html>