Gracias por responder @Panino5001. Para dejar mas claro las cosas, aqui dejo mi script:
Código PHP:
function selectInnerTxt (tg,clsNm)
{
tg.toLowerCase ();
var objs = document.getElementsByTagName(tg);
//
for (var i = 0; i < objs.length; i++)
{
if ( String(objs[i].getAttribute('class')).indexOf(clsNm) != -1 )
{
objs[i].title = 'Click para copiar';
objs[i].onclick = function ()
{
if (tg == 'input' || tg == 'textarea')
{
this.select ();
}
if (tg == 'div' || tg == 'span')
{
var range;
if (document.selection)
{
range = document.body.createTextRange ();
range.moveToElementText (this);
range.select ();
} else if (window.getSelection)
{
range = document.createRange ();
range.selectNode (this);
window.getSelection().addRange (range);
}
}
}
}
}
}
A esa funcion le paso los parametros del tipo de tag a buscar en toda la pagina mas los objetos que tengan una clase en especifico. Como ves, esto afecta a todos los objetos en la pagina a partir de los parametros para hacerlo mas automatizado.
Como podria corregirlo para que no se borre el texto de los TEXTAREA e INPUT-TEXT ??. Alguna sugerencia ??. Muchas gracias por tu ayuda.