Ver Mensaje Individual
  #9 (permalink)  
Antiguo 28/03/2012, 15:53
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Relacionar 2 opciones (checkbox) y dar un mensaje de correcto ó incorrecto

Amigo @huertas87, como verás, esta ya no es cuestión de darte una solución, es más bien parte de la locura de alguno de nosotros. Si mi inefable colega @furoya, no tiene objeciones, creo que a la siguiente, la podríamos considerar como la solución final.
Código HTML:
Ver original
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2.    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  5. <title>UNIR EL NOMBRE CON EL APELLIDO.</title>
  6.  
  7. <style type="text/css">
  8. /*<![CDATA[*/
  9.  
  10. label, #mensajes {
  11. font-family: arial;
  12. }
  13.  
  14. /*]]>*/
  15. <script type="text/javascript">
  16. //<![CDATA[
  17. var n;
  18. var a;
  19. function evalua(N){
  20. n = parseInt(N);
  21. }
  22. function evalua2(N){
  23. a = parseInt(N);
  24. }
  25. function suma(){
  26. if(n == undefined){
  27. a=parseInt('300');
  28. document.getElementById('mensajes').innerHTML = "Seleccione un nombre primero";
  29. document.getElementById('nya').reset();
  30. return false;
  31. }else{
  32. if((n+a)==9){
  33. var idn = 'i_'+n.toString();
  34. var ida = 'i_'+a.toString();
  35. var idln = 'l_'+n.toString();
  36. var idla = 'l_'+a.toString();
  37. var msj = document.getElementById('mensajes');
  38. msj.innerHTML = "Correcto"
  39. document.getElementById(idn).disabled = true;
  40. document.getElementById(ida).disabled = true;
  41. document.getElementById('mensajes').style.color = 'green';
  42. document.getElementById(idln).style.textDecoration = 'line-through';
  43. document.getElementById(idla).style.textDecoration = 'line-through';
  44. a=parseInt('300');
  45.  
  46. }else{
  47. document.getElementById('mensajes').innerHTML = "Incorrecto";
  48. document.getElementById('mensajes').style.color = 'red';
  49. }
  50. }
  51. n = undefined;
  52. document.getElementById('nya').reset();
  53. }
  54. //]]>
  55. </head>
  56. <form id="nya" name="nya" action="#">
  57. <table border="1" cellpadding="5" bgcolor="blue" width="300">
  58. <tr bgcolor="red">
  59. <th colspan="2">Arte MADÍ.</th>
  60. </tr>
  61. <tr>
  62. <td bgcolor="yellow">
  63. <input type="radio" id="i_0" name="nombre" onclick="evalua(this.value);" value="0" /><label id="l_0" for="i_0">Carmelo</label><br />
  64. <input type="radio" id="i_1" name="nombre" onclick="evalua(this.value);" value="1" /><label id="l_1" for="i_1">José</label><br />
  65. <input type="radio" id="i_2" name="nombre" onclick="evalua(this.value);" value="2" /><label id="l_2" for="i_2">Martín</label><br />
  66. <input type="radio" id="i_3" name="nombre" onclick="evalua(this.value);" value="3" /><label id="l_3" for="i_3">Juan</label><br />
  67. <input type="radio" id="i_4" name="nombre" onclick="evalua(this.value);" value="4" /><label id="l_4" for="i_4">Gyula</label><br /></td>
  68. <td bgcolor="lime">
  69. <input type="radio" id="i_5" name="apellido" onclick="evalua2(this.value);suma();" value="5" /><label id="l_5" for="i_0">Kosice</label><br />
  70. <input type="radio" id="i_9" name="apellido" onclick="evalua2(this.value);suma();" value="9" /><label id="l_9" for="i_9">Arden Quin</label><br />
  71. <input type="radio" id="i_6" name="apellido" onclick="evalua2(this.value);suma();" value="6" /><label id="l_6" for="i_6">Bay</label><br />
  72. <input type="radio" id="i_8" name="apellido" onclick="evalua2(this.value);suma();" value="8" /><label id="l_8" for="i_8">Aguiar</label><br />
  73. <input type="radio" id="i_7" name="apellido" onclick="evalua2(this.value);suma();" value="7" /><label id="l_7" for="i_7">Blaszko</label><br /></td>
  74. </tr>
  75. <tr><td colspan="2" bgcolor="white" id="mensajes" align="center">mensajes<!-- mensajes --></td></tr>
  76. </form>
  77. </body>
  78. </html>

Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.

Última edición por emprear; 28/03/2012 a las 16:12