L
LuisDavid
buenos dias grupo, tenia este problema, como puedo hacer para que
cambie el fondo de una celda, haciendo click, que cambie celda por
celda, no todas a la vez como se muestra:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
window.onload = function(){
docCells = document.getElementsByTagName("td");
for(i=0;i<docCells.length;i++){
docCells.onmouseover = new Function ("if
(this.style.backgroundColor == '')this.style.backgroundColor =
'blue'");
docCells.onmouseout = new Function ("if
(this.style.backgroundColor == 'blue')this.style.backgroundColor =
''");
docCells.onclick = new Function("if(this.style.backgroundColor ==
'blue')this.style.backgroundColor = 'red'");
}
}
</script>
<style type="text/css">
td{border:thin solid silver;}
</style>
</head>
<body>
<table>
<tr>
<td>Cell 1-1</td><td>Cell 1-2</td>
</tr>
<tr>
<td>Cell 2-1</td><td>Cell 2-2</td>
</tr>
</table>
</body>
</html>
la idea es que quede resaltado una celda, la que elija el usuario, y
no todas, como me queda, como puedo hacerlo, ayuda grupo; gracias de
antemano, por la ayuda que me puedan brindar.
cambie el fondo de una celda, haciendo click, que cambie celda por
celda, no todas a la vez como se muestra:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/
TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script type="text/javascript">
window.onload = function(){
docCells = document.getElementsByTagName("td");
for(i=0;i<docCells.length;i++){
docCells.onmouseover = new Function ("if
(this.style.backgroundColor == '')this.style.backgroundColor =
'blue'");
docCells.onmouseout = new Function ("if
(this.style.backgroundColor == 'blue')this.style.backgroundColor =
''");
docCells.onclick = new Function("if(this.style.backgroundColor ==
'blue')this.style.backgroundColor = 'red'");
}
}
</script>
<style type="text/css">
td{border:thin solid silver;}
</style>
</head>
<body>
<table>
<tr>
<td>Cell 1-1</td><td>Cell 1-2</td>
</tr>
<tr>
<td>Cell 2-1</td><td>Cell 2-2</td>
</tr>
</table>
</body>
</html>
la idea es que quede resaltado una celda, la que elija el usuario, y
no todas, como me queda, como puedo hacerlo, ayuda grupo; gracias de
antemano, por la ayuda que me puedan brindar.