<html>
<head>
<meta charset="utf-8">
<style type="text/css">
p.simulaLink {color: blue; cursor:pointer;}
</style>
<script type="text/javascript">
function transformarEnEditable(nodo) {
var nodoContent = nodo.querySelectorAll("p");
var claveInicial = nodoContent[0].firstChild.nodeValue;
var nombreInicial = nodoContent[1].firstChild.nodeValue;
var especialidadInicial = nodoContent[2].firstChild.nodeValue;
var consultorioInicial = nodoContent[3].firstChild.nodeValue;
var unidadInicial = nodoContent[4].firstChild.nodeValue;
var cedulaInicial = nodoContent[5].firstChild.nodeValue;
var nuevoCodigo = '<tr>'+
'<td> <input type="text" name="id" id="id" value="'+claveInicial+'" size="10"></td>'+
'<td> <input type="text" name="titulo" id="titulo" value="'+nombreInicial+'" size="10"></td>'+
'<td> <input type="text" name="texto" id="texto" value="'+especialidadInicial+'" size="20"></td>'+
'<td> <input type="text" name="categoria" id="categoria" value="'+consultorioInicial+'" size="10"></td>'+
'<td> <input type="text" name="fecha" id="fecha" value="'+unidadInicial+'" size="10"></td>'+
'<td> <input type="text" name="imagen" id="imagen" value="'+cedulaInicial+'" size="10"></td>'+
'<td> <p class="simulaLink">Guardar cambios</p>'+
'<p>Borrar</p></td>'+
'</tr>';
nodo.innerHTML = nuevoCodigo;
}
</script>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td><p><b>Clave</b></p></td>
<td><p><b>Nombre</b></p></td>
<td><p><b>Especialidad</b></p></td>
<td><p><b>Consultorio</b></p></td>
<td><p><b>Unidad Médica</b></p></td>
<td><p><b>Cedula Profesional</b></p></td>
<td> </td>
</tr>
<tr>
<td><p><?php echo $row['doc_cve']; ?></p></td>
<td><p><?php echo $row['doc_nombre']; ?></p></td>
<td><p><?php echo $row['doc_especialidad']; ?></p></td>
<td><p><?php echo $row['doc_consultorio']; ?></p></td>
<td><p><?php echo $row['doc_unidadmedica']; ?></p></td>
<td><p><?php echo $row['doc_ced_prof']; ?></p></td>
<td><p class = "simulaLink" onclick="transformarEnEditable(this.parentNode.parentNode)">Editar</p>
<p>Borrar</p></td>
</tr>
<?php } ?>
</tbody>
</table>
</body>
</html>