Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

João Augusto

Dar focus ao input

Recommended Posts

usando a função focus você consegue..

 

http://www.w3schools.com/HTMLDOM/met_text_focus.asp

 

t+

 

Cara naum funcionou não.

Oq ocorre é que esse button faz os inputs surgirem dentro da tabela e a tabela tem uma barra de rolagem e os inputs surgem no final da tabela o que eu realmente kero é quando eu clicar para aparecer os inputs ele dar focus ao 1° input....

vou te mandar meu cod..........

 

<script>
function mostrar(x,w){
div=document.getElementById(w);
if(div.style.display=="none"){
div.style.display="";
}
else if(div.style.display=="") {
x.value="Incluir";
div.style.display="none"; 
}
}
</script>
  
	<script language="javascript">
  function AbreModal(url)
  {
	window.showModalDialog(url,window,"dialogWidth:680px;dialogHeight:200px");
  }
</script>
  
		<style type="text/css">
table {font: normal 11px "Lucida Console";}
table{margin: 0px;}
table,th,td{border-collapse: collapse;}
th,td{border-bottom: 0px solid #000000;padding: 0px;}
th span{display: block; padding: 3px}
td span{display: block; padding: 3px}
#lista table {width:620px;}
#lista th{color: #FFFFFF;background-color: #181AC5;text-align: left}
#lista.tabContainer {width: 620px;border: 1px solid #000000}
#lista.scrollContainer {width: 622px;height: 400px;overflow: auto;}
.font{font-family: Verdana, Arial, Helvetica, sans-serif;
font-size:13px;
font-style:normal;
font-weight: bold;
font-variant: normal;
color:#FFFFFF;}  
	</style>
  
  
  <tr>
   <td colspan="5" align="center" valign="middle" background="file:///G|/WFat/img/layout.jpg">
<form action="file:///G|/WFat/wfat.cgi" name="fCadFir" method="post">
<div align="center"><table width="99%" height="178" align="center" class="corpo-mono">
  <tr><td><br>
  <fieldset class="corpo-mono">
<legend class="fieldset-legend">Cadastro de Serviços:</legend>
<br>
  
					 <div align="center">
							  <div class="tabContainer" id="lista">
								<div class="scrollContainer" id="lista">
								  <table width="695" border="0">
									<tbody>
									  <tr>
										<td bgcolor="#0A36E4" class="font"><span>  Código</span> </td>
										<td width="191" bgcolor="#0A36E4" class="font" align="left"><span>Descrição        Perfil >></span></td>
										<td colspan="2"  bgcolor="#0A36E4" align="center" class="font">A</td>
										<td width="69" bgcolor="#0A36E4" class="font" align="center">B</td>
										<td width="69" bgcolor="#0A36E4" class="font" align="center">C</td>
										<td width="71" bgcolor="#0A36E4" class="font" align="center">D</td>
										<td width="134" bgcolor="#0A36E4" class="font" align="left"><span>     E</span> </td>
									  </tr>
									  
									  <tab>
									  
									  <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" checked />
										  <cod> 1231</span></td>
										<td colspan="2" align="left"><des>3232323232323232323232</td>
										<td width="75"><vla> -12.05</td>
										<td width="69"><vlb> -12.05</td>
										<td width="69"><vlc> -12.05</td>
										<td width="71"><vld> -12.05</td>
										<td width="134"><vle> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
									   <tr>
										<td width="77"><span>
									  <input type="radio" name="cde" value=12317 checked />
										  1231</span></td>
										<td colspan="2" align="left">3232323232323232323232</td>
										<td width="75"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="69"> -12.05</td>
										<td width="71"> -12.05</td>
										<td width="134"> -12.05</td>
									  </tr>
								   
					   
									  <tr id="botoes" style="display:none">
										<td width="77"> <input type="text" name="cod2" size="4" maxlength="4" value="SR" ></td>
										<td colspan="2" align="left"><input type="text" name="cde" size="24" maxlength="26"></td>
										<td width="75"><input type="text" name="cde" size="4" maxlength="7"></td>
										<td width="69"><input type="text" name="cde" size="4" maxlength="7"></td>
										<td width="69"><input type="text" name="cde" size="4" maxlength="7"></td>
										<td width="71"><input type="text" name="cde" size="4" maxlength="7"></td>
										<td width="134"><input type="text" name="cde" size="4" maxlength="7"> <input type="submit" value="OK" name="btn"></td>
									  </tr>
									</tbody>
								  </table>
						  </div>
							  </div>
					  </div>
					  <br />
					  <br>
					  <div align="center">
						<input type="button" name="btn2" value="Incluir" onClick="mostrar(this,'botoes')"  />   
					  <input type="button"  name="btn" value="Alterar" onClick="AbreModal('editar.html')">   <input type="submit" name="btn" value="Excluir">   		   </div>
  </fieldset></td></tr></table>
</div></form>

 

vlw..............

 

Alguém ai tem a solução pro meu problema??

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.