Ir para conteúdo

Arquivado

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

ricardomachado

BGCOLOR de uma linha na tabela <tr>

Recommended Posts

Ai o que eu quero eh o seguinte....Tenho uma listagem de registros na minha página e uso um checkbox para deletar....Gostaria que quando o usuário marcasse o checkbox a linha referente ao que ele cliclou mudasse de cor .... justamente para destacar essa marcação....Será que alguém pode me ajudar com isso ...?????flw ... |pirata|

Compartilhar este post


Link para o post
Compartilhar em outros sites

tow ligado, sempreuso isso nos meus admins, tenho um script que peguei do MyAdminSQL:

 

aconselho a usá-lo num arquivo .js

 

 

var markedRow = new Array();function setPointer(theRow, thePointerColor, theNormalBgColor){	var theCells = null;	if (thePointerColor == '' || typeof(theRow.style) == 'undefined'){	//return false;	}	if (typeof(document.getElementsByTagName) != 'undefined') {	theCells = theRow.getElementsByTagName('td');	}else if (typeof(theRow.cells) != 'undefined'){  theCells = theRow.cells;  }else{  return false;	}		var rowCellsCnt  = theCells.length;	var currentColor = null;	var newColor     = null;	if (typeof(window.opera) == 'undefined' && typeof(theCells[0].getAttribute) != 'undefined' && typeof(theCells[0].getAttribute) != 'undefined'){  currentColor = theCells[0].getAttribute('bgcolor');  newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())  ? theNormalBgColor  : thePointerColor;  for(var c = 0; c < rowCellsCnt; c++){  theCells[c].setAttribute('bgcolor', newColor, 0);  }	}else{  currentColor = theCells[0].style.backgroundColor;  newColor     = (currentColor.toLowerCase() == thePointerColor.toLowerCase())  ? theNormalBgColor  : thePointerColor;  for(var c = 0; c < rowCellsCnt; c++){  theCells[c].style.backgroundColor = newColor;  }	}	return true;}

 

pra usar:

 

<table width=80% border=0 cellspacing=0 cellpadding=0>

<tr onmouseover="setPointer(this, 'C0D9D9', 'ffffff')" onmouseout="setPointer(this, 'ffffff', 'C0D9D9')">

<td>ok1</td>

<td align=right>ok2</td>

</td>

</table>

Compartilhar este post


Link para o post
Compartilhar em outros sites

Sua função eh muito boa...mas eu quero uma opção para quando marcar o CHECKBOX.... a linha mude de cor e permeneça com aquela cor ate que o CHECKBOX seje desmarcado...será que alguém pode me ajudar ????vlw...

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.