Ver Mensaje Individual
  #3 (permalink)  
Antiguo 10/10/2011, 11:09
Avatar de America|UNK
America|UNK
 
Fecha de Ingreso: noviembre-2006
Ubicación: Piura - Perú
Mensajes: 582
Antigüedad: 17 años, 5 meses
Puntos: 56
Respuesta: Formulario segun opciones

Algo parecido:

Código Javascript:
Ver original
  1. <select id='idioma'>
  2.     <option value='ES'>Español</option>
  3.     <option value='EN'>Ingles</option>
  4. </select>
  5.  
  6. <span rel='lengua:nom'>...</span> <input type='text'/>
  7. <span rel='lengua:ape'>...</span> <input type='text'/>
  8.  
  9. <script>
  10. DEFAULT_LANG = 'ES'
  11. IDIOMAS = {
  12.     'ES' : {
  13.         nom : 'Escribe tu nombre:',
  14.         ape : 'Apellido:'
  15.     },
  16.     'EN' : {
  17.         nom : 'Type your name:',
  18.         ape : 'Lastname:'
  19.     }
  20. };
  21. (function(){
  22.     var lang = function(e,z){
  23.         var textos = document.getElementsByTagName('*'),i,l
  24.         for(var i=0,l=textos.length;i<l;i++){
  25.             var langVar = (textos[i].getAttribute('rel')||'').split(':')
  26.             if(langVar[1]) textos[i].innerHTML =  IDIOMAS[(z?e:this.value)][langVar[1]] || ('No lang:' + langVar[1])
  27.         }
  28.     }
  29.     document.getElementById('idioma').onchange = lang
  30.     lang(DEFAULT_LANG,1)
  31. })()
  32. </script>
__________________
/* El que atiende, entiende..., el que entiende, aprende!.
Desarrollo Web Freelance, Contactar */