RadioButton y textLink

  • vickriz
  • Novice
  • Novice
  • Avatar de Usuario
  • Registrado: Jul 28, 2003
  • Mensajes: 31
  • Loc: Phlippines
  • Status: Offline

Nota Julio 31st, 2003, 10:27 pm

Hola soy de nuevo una vez más en busca de ayuda ..

Tengo este código, de clic en el botón de radio o en el enlace al lado de él, ¿cómo podemos obtener para activar o desactivar algunos elementos de formulario ..

Código: [ Select ]
<table width="100%" cellpadding="3" cellspacing="1">
    <tr>
        <td><input type="radio" name="NominateAs" id="Nominated" accesskey="O"></td>
        <td><a href="#">N<span>o</span>minated</a></td>
        <td class="column2"><input type="radio" name="NominateAs" id="NominatedBy" accesskey="P"></td>
        <td class="column2"><a href="#">Nominated by <span>P</span>arty</a></td>
    </tr>
    <tr>
        <td colspan="2">Nominater Title:</td>
        <td colspan="2" class="column2"><select name="NominaterTitle" size="1" multiple id="NominaterTitle" tabindex="16">
        <option value="-1" selected>------------------</option>
        <option value="1">Attorney</option>
        <option value="2">Chairman</option>
        <option value="3">Congressman</option>
        <option value="4">Engineer</option>
        <option value="5">Governor</option>
        <option value="6">Honorable</option>
        <option value="7">Mayor</option>
        <option value="8">Mr.</option>
        <option value="9">President</option>
        <option value="10">Senator</option>
        <option value="11">Vice-Mayor</option>
        </select></td>
    </tr>
    <tr>
        <td colspan="2">Nominater's LN:</td>
        <td colspan="2" class="column2"><input type="text" name="NominaterLN" id="NominaterLN" maxlength="50" size="30"></td>
    </tr>
    <tr>
        <td colspan="2">Nominater's FN:</td>
        <td colspan="2" class="column2"><input type="text" name="NominaterFN" id="NominaterFN" maxlength="50" size="30"></td>
    </tr>
    <tr>
        <td colspan="2">Nominater's MN:</td>
        <td colspan="2" class="column2"><input type="text" name="NominaterMN" id="NominaterMN" maxlength="50" size="25"></td>
    </tr>
    <tr>
        <td colspan="2">Nominater's NS:</td>
        <td colspan="2" class="column2"><input type="text" name="ccNominaterNS" id="NominaterNS" maxlength="4" size="8"></td>
    </tr>
</table>
....some of the code...
<td colspan="2" align="center">
  <input type="button" name="submit" value="Submit">&&&
  <input type="reset" name="reset" value="Reset">
  <br><small>Submit Once</small>
</td>
  1. <table width="100%" cellpadding="3" cellspacing="1">
  2.     <tr>
  3.         <td><input type="radio" name="NominateAs" id="Nominated" accesskey="O"></td>
  4.         <td><a href="#">N<span>o</span>minated</a></td>
  5.         <td class="column2"><input type="radio" name="NominateAs" id="NominatedBy" accesskey="P"></td>
  6.         <td class="column2"><a href="#">Nominated by <span>P</span>arty</a></td>
  7.     </tr>
  8.     <tr>
  9.         <td colspan="2">Nominater Title:</td>
  10.         <td colspan="2" class="column2"><select name="NominaterTitle" size="1" multiple id="NominaterTitle" tabindex="16">
  11.         <option value="-1" selected>------------------</option>
  12.         <option value="1">Attorney</option>
  13.         <option value="2">Chairman</option>
  14.         <option value="3">Congressman</option>
  15.         <option value="4">Engineer</option>
  16.         <option value="5">Governor</option>
  17.         <option value="6">Honorable</option>
  18.         <option value="7">Mayor</option>
  19.         <option value="8">Mr.</option>
  20.         <option value="9">President</option>
  21.         <option value="10">Senator</option>
  22.         <option value="11">Vice-Mayor</option>
  23.         </select></td>
  24.     </tr>
  25.     <tr>
  26.         <td colspan="2">Nominater's LN:</td>
  27.         <td colspan="2" class="column2"><input type="text" name="NominaterLN" id="NominaterLN" maxlength="50" size="30"></td>
  28.     </tr>
  29.     <tr>
  30.         <td colspan="2">Nominater's FN:</td>
  31.         <td colspan="2" class="column2"><input type="text" name="NominaterFN" id="NominaterFN" maxlength="50" size="30"></td>
  32.     </tr>
  33.     <tr>
  34.         <td colspan="2">Nominater's MN:</td>
  35.         <td colspan="2" class="column2"><input type="text" name="NominaterMN" id="NominaterMN" maxlength="50" size="25"></td>
  36.     </tr>
  37.     <tr>
  38.         <td colspan="2">Nominater's NS:</td>
  39.         <td colspan="2" class="column2"><input type="text" name="ccNominaterNS" id="NominaterNS" maxlength="4" size="8"></td>
  40.     </tr>
  41. </table>
  42. ....some of the code...
  43. <td colspan="2" align="center">
  44.   <input type="button" name="submit" value="Submit">&&&
  45.   <input type="reset" name="reset" value="Reset">
  46.   <br><small>Submit Once</small>
  47. </td>


Si el usuario hace clic en el botón de Nominación o enlace, el elemento Nominaters será habilitado. y si el botón NominatedByParty o haga clic en enlace será desactivado...
  • Anonymous
  • Bot
  • No Avatar
  • Registrado: 25 Feb 2008
  • Mensajes: ?
  • Loc: Ozzuland
  • Status: Online

Nota Julio 31st, 2003, 10:27 pm

  • RichB
  • Guru
  • Guru
  • Avatar de Usuario
  • Registrado: May 17, 2003
  • Mensajes: 1121
  • Loc: Boston
  • Status: Offline

Nota Agosto 1st, 2003, 11:02 pm

Im suponiendo que significa que usted desea que todos los campos Nominater discapacidad cuando nominado por el partido "es elegido y habilitado cuando" el Premio "está seleccionado. Im suponiendo también que desea que los enlaces de texto para seleccionar a sus botones de radio correspondiente. Para hacer esto de forma adicional en la parte de la cabeza del archivo html:
Código: [ Select ]
<script>
function choose(id){
// this selects the radio button that goes with the text link
document.getElementById(id).checked=true;
}
function disable(){
document.getElementById("NominaterTitle").disabled=true;
document.getElementById("NominaterLN").disabled=true;
document.getElementById("NominaterFN").disabled=true;
document.getElementById("NominaterMN").disabled=true;
document.getElementById("NominaterNS").disabled=true;
}
function enable(){
document.getElementById("NominaterTitle").disabled=false;
document.getElementById("NominaterLN").disabled=false;
document.getElementById("NominaterFN").disabled=false;
document.getElementById("NominaterMN").disabled=false;
document.getElementById("NominaterNS").disabled=false;
}
</script>
  1. <script>
  2. function choose(id){
  3. // this selects the radio button that goes with the text link
  4. document.getElementById(id).checked=true;
  5. }
  6. function disable(){
  7. document.getElementById("NominaterTitle").disabled=true;
  8. document.getElementById("NominaterLN").disabled=true;
  9. document.getElementById("NominaterFN").disabled=true;
  10. document.getElementById("NominaterMN").disabled=true;
  11. document.getElementById("NominaterNS").disabled=true;
  12. }
  13. function enable(){
  14. document.getElementById("NominaterTitle").disabled=false;
  15. document.getElementById("NominaterLN").disabled=false;
  16. document.getElementById("NominaterFN").disabled=false;
  17. document.getElementById("NominaterMN").disabled=false;
  18. document.getElementById("NominaterNS").disabled=false;
  19. }
  20. </script>

y luego cambiar los enlaces y las cajas de radio a este aspecto:
Código: [ Select ]
<td><input type="radio" name="NominateAs" id="Nominated" accesskey="O" onclick='enable()'></td>
<td><a href="#" onclick='choose("Nominated");enable()'>N<span>o</span>minated</a></td>
<td class="column2"><input type="radio" name="NominateAs" id="NominatedBy" accesskey="P" onclick='disable()'></td>
<td class="column2"><a href="#" onclick='choose("NominatedBy");disable()'>Nominated by <span>P</span>arty</a></td>
  1. <td><input type="radio" name="NominateAs" id="Nominated" accesskey="O" onclick='enable()'></td>
  2. <td><a href="#" onclick='choose("Nominated");enable()'>N<span>o</span>minated</a></td>
  3. <td class="column2"><input type="radio" name="NominateAs" id="NominatedBy" accesskey="P" onclick='disable()'></td>
  4. <td class="column2"><a href="#" onclick='choose("NominatedBy");disable()'>Nominated by <span>P</span>arty</a></td>


que también tendrá que añadir onreset = "enable ()" a la etiqueta formulario para restablecer los campos que se activa si el botón de reinicio en el formulario se hace clic, por lo que debería ser algo como esto:
Código: [ Select ]
<form name="whatever" onreset="enable()">
Free Programming Resources

Publicar Información

  • Total de mensajes en este tema: 2 mensajes
  • Usuarios navegando por este Foro: No hay usuarios registrados visitando el Foro y 187 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