El código de nodo HTML es el siguiente:
La copia del código es la siguiente:
<div id = "img_1">
<input type = "image" src = "img/cump.png"> </input>
<div id = "noteTxt" type = "text" onDblClick = "ChangeName (this.id);"> 123 </div>
</div>
JS EDITAR TEXTO DE NOTETXT, la función es la siguiente:
La copia del código es la siguiente:
Función ChangeName (NotetXtid) {
var noTetxt = document.getElementById (NotetXtid);
noTetxt.style.display = "None"; //. style.display = "bloque"
var div = noTetxt.ParentNode;
if (! document.getElementById ("notainput")) {
var text = document.createElement ("entrada");
text.type = "text";
text.id = "Notinput";
text.style.width = getStyle (Notetxt, 'Width');
text.style.height = getStyle (noteTxt, 'altura');
text.style.margintop = getStyle (noteTxt, 'margintop');
text.style.textalign = getStyle (noteTxt, 'textAlign');
text.value = noTetxt.innerhtml;
div.appendChild (texto);
text.select ();
text.onblur = function () {
noTetxt.style.display = "bloque";
noTetxt.innerhtml = text.value;
//text.style.display= "Ninguno";
div.removechild (texto);
}
}
}
// Obtener el estilo en el archivo CSS
función getStyle (obj, attr)
{
if (obj.CurrentStyle)
{
regresar obj.CurrentStyle [attr]; //ES DECIR
}demás{
return getComputedStyle (obj, falso) [attr]; // ff
}
}
CSS es el siguiente:
La copia del código es la siguiente:
.img_1 {
Ancho: 80px;
Altura: 70px;
Posición: Absoluto;
}
.notExtext {
Ancho: 80px;
Altura: 15px;
Text-Align: Center;
margen-top: 70px;
Descanso de palabras: quiebre;
}
El código es muy simple, por lo que no lo explicaré aquí. Los amigos pueden usarlo libremente y usarlo en sus propios proyectos.