Jump to content
Fórum Script Brasil
  • 0

Botao Limpar


Lord Ninja
 Share

Question

Olá a todos, gostaria de uma ajuda.

Tenho um gerador de tópicos para o meu site no qual tenho o seguinte trecho:

<tr>
                               <th colspan=4> </th>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Spoiler :</td>
                               <td><input name="spoiler[]" type="hidden" value="FileFactory" READONLY><img src=FileFactory.png /></td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Nome Link :</td>
                               <td width="54%" class=style1>
                                   <select id=nomelink[] size="1" name="nomelink[]">
                                           <OPTION value=Parte selected>Parte</OPTION>
                                   </SELECT>
                                   Agrupar: <input name="agrupalink[]" type="text" size="3" value="" READONLY></td>
                               </td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Links:</td>
                               <td class=style1 width=951 height=18><TEXTAREA name=link[] rows=10 cols=85></TEXTAREA></TD>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <th colspan=4> </th>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Spoiler :</td>
                               <td><input name="spoiler[]" type="hidden" size="61" value="FilesFlash" READONLY><img src=FilesFlash.png /></td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Nome Link :</td>
                               <td width="54%" class=style1>
                                   <select id=nomelink[] size="1" name="nomelink[]">
                                           <OPTION value=Parte selected>Parte</OPTION>
                                   </SELECT>
                                   Agrupar: <input name="agrupalink[]" type="text" size="3" value="" READONLY></td>
                               </td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Links:</td>
                               <td class=style1 width=951 height=18><TEXTAREA name=link[] rows=10 cols=85></TEXTAREA></TD>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <th colspan=4> </th>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Spoiler :</td>
                               <td><input name="spoiler[]" type="hidden" size="61" value="Minus" READONLY><img src=Minus.png /></td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Nome Link :</td>
                               <td width="54%" class=style1>
                                   <select id=nomelink[] size="1" name="nomelink[]">
                                           <OPTION value=Parte selected>Parte</OPTION>
                                   </SELECT>
                                   Agrupar: <input name="agrupalink[]" type="text" size="3" value="" READONLY></td>
                               </td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Links:</td>
                               <td class=style1 width=951 height=18><TEXTAREA name=link[] rows=10 cols=85></TEXTAREA></TD>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <th colspan=4> </th>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Spoiler :</td>
                               <td><input name="spoiler[]" type="hidden" size="61" value="RapidGator" READONLY><img src=RapidGator.png /></td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Nome Link :</td>
                               <td width="54%" class=style1>
                                   <select id=nomelink[] size="1" name="nomelink[]">
                                           <OPTION value=Parte selected>Parte</OPTION>
                                   </SELECT>
                                   Agrupar: <input name="agrupalink[]" type="text" size="3" value="" READONLY></td>
                               </td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Links:</td>
                               <td class=style1 width=951 height=18><TEXTAREA name=link[] rows=10 cols=85></TEXTAREA></TD>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <th colspan=4> </th>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Spoiler :</td>
                               <td><input name="spoiler[]" type="hidden" size="61" value="RapidShare" READONLY><img src=RapidShare.png /></td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Nome Link :</td>
                               <td width="54%" class=style1>
                                   <select id=nomelink[] size="1" name="nomelink[]">
                                           <OPTION value=Parte selected>Parte</OPTION>
                                   </SELECT>
                                   Agrupar: <input name="agrupalink[]" type="text" size="3" value="" READONLY></td>
                               </td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Links:</td>
                               <td class=style1 width=951 height=18><TEXTAREA name=link[] rows=10 cols=85></TEXTAREA></TD>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <th colspan=4> </th>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Spoiler :</td>
                               <td><input name="spoiler[]" type="hidden" size="61" value="UploadEd" READONLY><img src=UploadEd.png /></td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Nome Link :</td>
                               <td width="54%" class=style1>
                                   <select id=nomelink[] size="1" name="nomelink[]">
                                           <OPTION value=Parte selected>Parte</OPTION>
                                   </SELECT>
                                   Agrupar: <input name="agrupalink[]" type="text" size="3" value="" READONLY></td>
                               </td>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <td width='50px'></td>
                               <td width='205px' class=style1>Links:</td>
                               <td class=style1 width=951 height=18><TEXTAREA name=link[] rows=10 cols=85></TEXTAREA></TD>
                               <td scope='col' width='30px'></td>
                           </tr>
                           <tr>
                               <th colspan=4> </th>
                           </tr>

Neste trecho tenho a variável link[] 6 vezes que depois eu processo em um código php, o meu drama é, queria criar um botão que limpasse somente o conteúdo que foi digitado nestes campos link[] que são um textarea

Tentei de varias formas mas não consegui, se alguém puder me ajudar...

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Supondo que a tabela que você postou tenha um ID (se não tiver, coloque algum).

function limpaAreas() {
    var areas = document.getElementById('id_da_tabela').getElementsByTagName('textarea');
    for (var i = 0; i < areas.length; i++) {
        areas[i].value = '';
    }
}
<input type='button' value='limpa' onclick='limpaAreas()'/>

:)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share



  • Forum Statistics

    • Total Topics
      150.9k
    • Total Posts
      648.7k
×
×
  • Create New...