
10/10/2011, 11:09
|
 | | | Fecha de Ingreso: noviembre-2006 Ubicación: Piura - Perú
Mensajes: 582
Antigüedad: 18 años, 2 meses Puntos: 56 | |
Respuesta: Formulario segun opciones Algo parecido:
Código Javascript :
Ver original<select id='idioma'> <option value='ES'>Español</option> <option value='EN'>Ingles</option> </select> <span rel='lengua:nom'>...</span> <input type='text'/> <span rel='lengua:ape'>...</span> <input type='text'/> <script> DEFAULT_LANG = 'ES' IDIOMAS = { 'ES' : { nom : 'Escribe tu nombre:', ape : 'Apellido:' }, 'EN' : { nom : 'Type your name:', ape : 'Lastname:' } }; (function(){ var lang = function(e,z){ var textos = document.getElementsByTagName('*'),i,l for(var i=0,l=textos.length;i<l;i++){ var langVar = (textos[i].getAttribute('rel')||'').split(':') if(langVar[1]) textos[i].innerHTML = IDIOMAS[(z?e:this.value)][langVar[1]] || ('No lang:' + langVar[1]) } } document.getElementById('idioma').onchange = lang lang(DEFAULT_LANG,1) })() </script>
__________________ /* El que atiende, entiende..., el que entiende, aprende!.
Desarrollo Web Freelance, Contactar */ |