Javascript cuadro desplegable cambio

  • alex89
  • Bronze Member
  • Bronze Member
  • Avatar de Usuario
  • Registrado: Jul 18, 2008
  • Mensajes: 239
  • Loc: Western Australia
  • Status: Offline

Nota Julio 10th, 2009, 7:19 am

Ive consiguió dos conjuntos cuadro desplegable donde los usuarios pueden elegir el tiempo de inicio y fin de un evento

Cuando el primer desplegabe (hora de inicio) se cambia, id como la segunda vez que un (meta) para cambiar a una hora de antelación.

Inicio:
Código: [ Select ]
<select name="timestart[]" onchange="timefix(this.id)">
<option value="8">8:00</option>
<option value="9">9:00</option>
etc..
  1. <select name="timestart[]" onchange="timefix(this.id)">
  2. <option value="8">8:00</option>
  3. <option value="9">9:00</option>
  4. etc..


Acabado:
Código: [ Select ]
<select name="timeend[]">
<option value="9">9:00</option>
<option value="10">10:00</option>
etc..
  1. <select name="timeend[]">
  2. <option value="9">9:00</option>
  3. <option value="10">10:00</option>
  4. etc..


Javascript & #058;
Código: [ Select ]
function timefix(x)
{
var y=document.getElementById(x).value;
document.getElementById(??).value=y+1();
}
  1. function timefix(x)
  2. {
  3. var y=document.getElementById(x).value;
  4. document.getElementById(??).value=y+1();
  5. }


¿Qué debo poner para los signos de interrogación? (arriba en js)
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Julio 10th, 2009, 7:19 am

  • Rabid Dog
  • Web Master
  • Web Master
  • Avatar de Usuario
  • Registrado: May 21, 2004
  • Mensajes: 3229
  • Loc: South Africa
  • Status: Offline

Nota Julio 10th, 2009, 7:26 am

Código: [ Select ]
 
<html>
<head>
<script>
function timefix(start, end)
{
var y=document.getElementById(start).value;
document.getElementById(end).value=parseInt(y)+1;
}
</script>
</head>
<body>
<select name="timestart[]" id="timestart[]" onchange="timefix('timestart[]','timeend[]' )">
<option value="8">8:00</option>
<option value="9">9:00</option>
</select>
<select name="timeend[]" id="timeend[]">
<option value="9">9:00</option>
<option value="10">10:00</option>
</select>
</body>
</html>
  1.  
  2. <html>
  3. <head>
  4. <script>
  5. function timefix(start, end)
  6. {
  7. var y=document.getElementById(start).value;
  8. document.getElementById(end).value=parseInt(y)+1;
  9. }
  10. </script>
  11. </head>
  12. <body>
  13. <select name="timestart[]" id="timestart[]" onchange="timefix('timestart[]','timeend[]' )">
  14. <option value="8">8:00</option>
  15. <option value="9">9:00</option>
  16. </select>
  17. <select name="timeend[]" id="timeend[]">
  18. <option value="9">9:00</option>
  19. <option value="10">10:00</option>
  20. </select>
  21. </body>
  22. </html>
Watch me grow
  • alex89
  • Bronze Member
  • Bronze Member
  • Avatar de Usuario
  • Registrado: Jul 18, 2008
  • Mensajes: 239
  • Loc: Western Australia
  • Status: Offline

Nota Julio 10th, 2009, 7:46 am

Im tener un poco de dificultad para poner el primer bit en mi javascript (su matriz dinámica)

Código: [ Select ]
var start = '<select name="timestart[]" onchange="timefix('timestart[]','timeend[]' )"><option value="8">8:00</option> ... <option value="17">17:00</option></select>';
  • Rabid Dog
  • Web Master
  • Web Master
  • Avatar de Usuario
  • Registrado: May 21, 2004
  • Mensajes: 3229
  • Loc: South Africa
  • Status: Offline

Nota Julio 10th, 2009, 7:55 am

I reposted el script, por favor, un uso que
Watch me grow
  • Rabid Dog
  • Web Master
  • Web Master
  • Avatar de Usuario
  • Registrado: May 21, 2004
  • Mensajes: 3229
  • Loc: South Africa
  • Status: Offline

Nota Julio 10th, 2009, 7:57 am

PS No sé por qué usted está utilizando una matriz de control que sólo permite un valor seleccionado?
Watch me grow
  • alex89
  • Bronze Member
  • Bronze Member
  • Avatar de Usuario
  • Registrado: Jul 18, 2008
  • Mensajes: 239
  • Loc: Western Australia
  • Status: Offline

Nota Julio 10th, 2009, 7:58 am

Mejorar la generación de mis cuadros usando javascript - una tabla dinámica.

Ver aquí: http://uwadb.com/timetable/setup.php?id=cal
  • Rabid Dog
  • Web Master
  • Web Master
  • Avatar de Usuario
  • Registrado: May 21, 2004
  • Mensajes: 3229
  • Loc: South Africa
  • Status: Offline

Nota Julio 10th, 2009, 8:24 am

Por lo tanto, incrementar el nombre en el campo de ID de llamada y la función de campo
Watch me grow
  • alex89
  • Bronze Member
  • Bronze Member
  • Avatar de Usuario
  • Registrado: Jul 18, 2008
  • Mensajes: 239
  • Loc: Western Australia
  • Status: Offline

Nota Julio 10th, 2009, 8:30 am

Im no está seguro de cómo hacerlo.

La apóstrofes en el Ive got JavaScript para la tabla se lo que es difícil.

Código: [ Select ]
var start = '<select name="timestart[]" onchange="timefix('timestart[]','timeend[]' )"><option value="8">8:00</option> ... <option value="17">17:00</option></select>';


¿Hay alguna manera de cancelar el apóstrofo a cabo? Debido a que el PHP es generar el código JavaScript, una barra frente cancela en PHP, y no javascript.

¿Te lo que quiero decir?

Publicar Información

  • Total de mensajes en este tema: 8 mensajes
  • Usuarios navegando por este Foro: webspace y 131 invitados
  • No puede abrir nuevos temas en este Foro
  • No puede responder a temas en este Foro
  • No puede editar sus mensajes en este Foro
  • No puede borrar sus mensajes en este Foro
  • No puede enviar adjuntos en este Foro
 
 

© 2011 Unmelted, LLC. Ozzu® es una marca registrada de Unmelted, LLC