Hi!

My problem is that obj.name, or any of its derivatives do not seem to work in FF and Chrome, but work fine in IE.

The variable obj stems from
Code:
function catchIt(e) {
	if (editing) return;
	if (!document.getElementById || !document.createElement) return;
	if (!e) var obj = window.event.srcElement;
	else var obj = e.target;
How come obj.name becomes undefined when i alert it? What can be changed to accommodate the script for FF and Chrome as well?
The rest of the code:
Code:
var editing  = false;

var xmlHttp


if (document.getElementById && document.createElement) {
	var butt = document.createElement('BUTTON');
	var buttext = document.createTextNode('OK');
	butt.appendChild(buttext);
	butt.onclick = saveEdit;
}

function catchIt(e) {
	if (editing) return;
	if (!document.getElementById || !document.createElement) return;
	if (!e) var obj = window.event.srcElement;
	else var obj = e.target;

	while (obj.nodeType != 1) {
		obj = obj.parentNode;
	}
	if (obj.tagName == 'TEXTAREA' || obj.tagName == 'A') return;
	while (obj.nodeName != 'P' && obj.nodeName != 'HTML') {

		obj = obj.parentNode;

	}

	if (obj.nodeName == 'HTML') return;
	var x = obj.innerHTML;
	var w = obj.name;
	var y = document.createElement('TEXTAREA');
	y.id=obj.id;
	//y.name = obj.name;
	alert(w);
	var z = obj.parentNode;
	z.insertBefore(y,obj);
	z.insertBefore(butt,obj);
	z.removeChild(obj);
	y.value = x;
	y.name = w;
	y.focus();
	editing = true;
	area=y;

}


function saveEdit() {
//	var area = document.getElementsByTagName('TEXTAREA')[0];
	var y = document.createElement('P');
	var z = area.parentNode;
	y.name = area.name;
	//alert(y.name);
	var iden = area.id;
	y.id = iden;
	y.innerHTML = area.value;
	z.insertBefore(y,area);
	z.removeChild(area);
	z.removeChild(butt);
//	z.removeChild(document.getElementsByTagName('BUTTON')[0]);
	editing = false;

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
 } 


alert(iden+" uppdaterat!");
//var pidenn=$piden;
//var pidenn = encodeURIComponent(document.getElementById('pjotor').innerHTML);
var pidenn = y.name;
//alert(pidenn);
alert(y.name);
var url="extragete.php"
url=url+"?q="+encodeURIComponent(area.value)+"&id="+pidenn+"&iden="+iden
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)



function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
// document.getElementsByTagName('P')[0].innerHTML=decodeURIComponent(xmlHttp.responseText) 
 } 
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}



}
document.onclick = catchIt;


//	var iden = document.getElementsByTagName("P")[0].id;