PDA

View Full Version : Help with Errors


tyfeatherston
03-21-2008, 06:47 PM
I want this script to run with out an error. It currently deletes a row from a table after if runs a php scipt.

Everything works but I get two errors.

document.getElementbyId(...).deleteRow(...) is null or not an object.

and

runtime error on line 35 // which is on the same line as the other error.

// JavaScript Document - FM_CMS Ajax

var xmlHttp

var rowloc

function getRow(loc)
{
rowloc=loc
}

function Delete(str, temploc)
{
getRow(temploc)
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="delete.php"
url=url+"?id="+str
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")
{
if(rowloc != null)
{
// line 35 // document.getElementById('contenttable').deleteRow(rowloc).innerHTML=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;
}

A1ien51
03-25-2008, 03:12 AM
How can you delete a row and set its innerHTML? Sounds fishy to me.

Eric