Ver Mensaje Individual
  #12 (permalink)  
Antiguo 01/01/2010, 14:59
GardBeat
 
Fecha de Ingreso: diciembre-2003
Ubicación: Universidad de la Vida
Mensajes: 136
Antigüedad: 20 años, 5 meses
Puntos: 1
Respuesta: (Novato) Paso a Notación Semántica

He realizado una modificaciones siguendo lo que me has menciado, y ya por curiosidad y seguir trasteando mi codigo y pasarlo al mal llamado "semantico", asi se me ha quedado el codigo, pero no me termina de funcionar, alguien me detecta el error. Gracias de antemano.

Cita:
<html>
<head>
<title>Seleccion de Imagenes</title>
<script type="text/javascript">

window.onload = function () {

document.getElementsByName("menu").onchange = cambiarA(this);
}


var _img = new Array();
_img[0] = new Image();
_img[0].src="img/img0.jpg";
_img[1] = new Image();
_img[1].src="img/img1.jpg";
_img[2] = new Image();
_img[2].src="img/img2.jpg";
_img[3] = new Image();
_img[3].src="img/img3.jpg";

function cambiarA(_obj) {

if(!_obj) return;

var _index = _obj.selectedIndex;

if(!_index) return;

var _item = _obj[_index].value;

if(!_item) return;

if(_item<0 || _item >=_img.length) return;

document.images["Imagen"].src=_img[_item].src;

}

</script>
</head>
<body>
<img src="img/img0.JPG" width="128" height="96" border="0" name="Imagen">

<form id="formulario">
<select name="menu">
<option value="">Seleccionar Imagen</option>
<option value="0">Imagen 1</option>
<option value="1">Imagen 2</option>
<option value="2">Imagen 3</option>
<option value="3">Imagen 4</option>
</select>
</form>

</body>
</html>
__________________
GardBeat

Última edición por GardBeat; 01/01/2010 a las 15:00 Razón: Actualizacion codigo