Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2007
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Help with Errors

    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;
    }

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    How can you delete a row and set its innerHTML? Sounds fishy to me.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •