Jump to content


Photo

Mudar Cor Da Linha Da Tabela


  • Faça o login para participar
6 replies to this topic

#1 knoxville

knoxville

    Backdoor Man

  • Usuários
  • 951 posts
  • Sexo:Masculino
  • Localidade:Itajaí - SC

Posted 14/03/2007, 16:41

boa tarde!!
tenho uma tabela onde são listados todos os clientes de um banco de dados
________________________________
| cliente | cidade | telefone | controle |
|cliente1|cidade/uf|(dd)9393|editar/apagar|
|cliente2|cidade/uf|(dd)9696|editar/apagar|

onde é listado, é uma linha cinza e outra branca, alternando pra ficar mais facil a leitura/localização

agora preciso que quando eu posicione o mouse em qualquer celula da tabela, toda a linha fique azul claro, tirando o mouse de cima, volta pra cor que era antes... clicando em cima (qualquer posição da linha) execute um js (essa parte eu tb gostaria de saber) q vai abrir os detalhes do cliente como endereço, etc em uma div layer (essa parte é comigo!)

alguem sabe me ajudar? eu achei pouca coisa no forum, só sobre o mudar de cor, mas nos que tinha, ela nao voltava pra cor anterior quando tirasse o mouse...
vlw! :boxing:



DESCULPA, DÚVIDA NO LUGAR ERRADO... FAVOR APAGAR!

Edição feita por: knoxville, 14/03/2007, 16:46.


#2 Bruno Augusto

Bruno Augusto

    ∙•● Restarting... ●•∙

  • Usuários
  • 1968 posts
  • Sexo:Não informado
  • Localidade:Itajubá

Posted 14/03/2007, 19:37

Não sou um mestre em JavaScript, estou aprendendo, mas isso faz tudo o que você quer:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script type="text/javascript">
function mouseOver( id, color ) {
	var id = document.getElementById( id );
	id.style.backgroundColor = color;
}
function mouseOut( id, color ) {
	var id = document.getElementById( id );
	id.style.backgroundColor = color; /* Define a cor de fundo padrão */
}

function mostraDetalhes( id, show )
{
	var IE	= (navigator.appVersion.indexOf("MSIE") > - 1);

	var id = document.getElementById( id );
	id.style.display = ! show ? "none" : IE ? "inline" : "table-row";
}
		
</script>
</head>

<body>
<table width="100%" border="1" style="border-collapse: collapse;">
  <tr id="linha1" onmouseover="mouseOver( this.id, '#f3ffff' );" onmouseout="mouseOut( this.id, '#ffffff' );" onclick="mostraDetalhes( 'divOculta', true );">
	<td>&nbsp;</td>
  </tr>
  <tr id="divOculta" style="display: none;">
	  <td>
	Óia eu aqui!
	<br />
	<strong><a href="java script:void(0)" onclick="mostraDetalhes( 'divOculta', false );">[ Fechar ]</a></strong>
	</td>
  </tr>
  <tr id="linha2" onmouseover="mouseOver( this.id, '#f3ffff' );" onmouseout="mouseOut( this.id, '#ffffff' );" onclick="mostraDetalhes( 'divOculta2', true );">
	<td>&nbsp;</td>
  </tr>
  <tr id="divOculta2" style="display: none;">
	  <td>
	Óia eu aqui de novo!
	<br />
	<strong><a href="java script:void(0)" onclick="mostraDetalhes( 'divOculta2', false );">[ Fechar ]</a></strong>
	</td>
  </tr>
  <tr id="linha3" onmouseover="mouseOver( this.id, '#f3ffff' );" onmouseout="mouseOut( this.id, '#ffffff' );" onclick="mostraDetalhes( 'divOculta3', true );">
	<td>&nbsp;</td>
  </tr>
  <tr id="divOculta3" style="display: none;">
	  <td>
	Óia eu aqui outra vez!
	<br />
	<strong><a href="java script:void(0)" onclick="mostraDetalhes( 'divOculta3', false );">[ Fechar ]</a></strong>
	</td>
  </tr>  
</table>

</body>
</html>
Tem as linhas, mudam de cor com o mouse em cima (onMouseOver), voltam para, no caso branco, sem o mouse (onMouseOut) e abrem uma linha de tabela oculta ao clicar (onClick).

Fiz baseado em tabela pois você deu a entender que vai usar tabelas, se fosse usar somente DIV's no melhor estilo Tableless, a função mostraDetalhes() seria um pouco diferente.

Agora é só você estudar o código, estilizar a tebale e ser feliz. :lol:

Testado no IEca 7 e no Firefox 2.0.0.2

[]'s

#3 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 18/09/2017, 23:47

Nitrofurantoin online pharmacy Viagra Oder Cialis Nebenwirkungen Cheap Kamagra Eu Priligy When To Take online pharmacy Cialis Nebenwirkung Kopfschmerzen
Viagra Super Active 100 Mg buy cialis Kamagra Belgio
Propecia Payment Vente Generic Kamagra Super Active
Cialis 10 Mg Wirkstoff <a href=http://cialtobuy.com>cialis online</a> Viagra Rezeptfrei Potenzmittel
Amoxicillin Safe Pregnancy online pharmacy Cialis Baratos Sin Receta Viagra 100mg Filmtabletten 12 Stuck Generic Doryx 100mg Bacterial Infections Direct Free Consultation Complaints About Healthy Man Viagra Buy Discount Macrobid By Money Order Direct buy cialis Statins From Over Seas Pharmacy

#4 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 06/10/2017, 23:25

Active Ingredients In Amoxicillin Amoxicillin And Breastfeeding Cialis Generika Preiswert levitra plus Propecia Fue Bueno Keflex Pediatric Dosing Generic Viagra Echeck Pharmacy
Amoxicillin Trihydrate 875mg Clavulanate K 125mg cialis Propecia Farmacia Propecia Pesetas Need Zentel Delivered On Saturday In Internet Overseas

#5 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 23/10/2017, 00:18

Effets Cialis Generique viagra Dove Trovare Cialis Senza Ricetta
Acquistare Cialis Online Stendra Priligy Nolvadex Tamoxifen levitra prices Venta Viagra Generico Cialis Propecia O Viagra

#6 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 02/11/2017, 15:43

Amoxicilina Tab Direct generic viagra Propecia Sale Online Uk

#7 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 30/11/2017, 03:55

Cialis 5 Mg Price Walmart Cialis Inde vardenafil canadian pharmacy Que Es El Cialis Y Para Que Sirve Pimozide
Medicament Pour Avorter Sans Ordonnance cialis Viagra Flussig Nebenwirkungen




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq