Ver Mensaje Individual
  #9 (permalink)  
Antiguo 26/07/2007, 20:19
Avatar de caricatos
caricatos
Moderador
 
Fecha de Ingreso: abril-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 19.607
Antigüedad: 22 años, 11 meses
Puntos: 1284
Re: el "+" no me concatena las cadenas ¿Por qué?

Hola:

Me parece que el error está en el código que no muestras... document.foteli.src no se vé, y donde aplicas el fondo es en fotelis (plural)...

por cierto, el cálculo que haces lo veo un poco complejo... prueba esta línea:

Código:
temporal = (temporal + b + img_vp.length) % img_vp.length;
El estilo del ini no debe terminar en punto y coma... hay un atributo src en fotelis, como si fuese un marco o una imagen...

Te paso un código que funciona:

Código:
<html>
<head>
<script>
var img_vp=["miemoticon.gif","tintero.gif","utensillos.gif"]; 
var img_cant=2; 
var temporal=0; 
var dir="../dibujos/"; 
function ini(){ 
    document.getElementById('fotelis').style.backgroundImage="url(http://imagesforum.doctissimo.fr/mesimages/1676940/hola.gif)" 
} 

function cambiaf(b){ 
temporal = (temporal + b + img_vp.length) % img_vp.length;
    document.getElementById('fotelis').style.backgroundImage="url("+dir+img_vp[temporal]+")"; 
    document.getElementById("ver").innerHTML = temporal; 
}  
window.onload=ini;
</script>
</head>
<body>
<input type="button" value="cambiar más" onclick="cambiaf(1)">
<input type="button" value="cambiar menos" onclick="cambiaf(-1)">

<div style="height: 150px; width: 150px; background-color: #eeeeee" id="fotelis" ></div>
<div id="ver" ></div>
</body>
</html>
Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo