'No element found' error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • C.Joseph Drayton

    'No element found' error

    Hi All,

    I am not sure if this is a JavaScript or PHP error. Basically what
    is happening, is that I have an HTML page with the following
    JavaScript. As you can see makeRequest() calls a PHP script which is
    included below.

    When the code is executed, I get the following error in FireFox's
    JavaScript console;
    >>>> Start Error Message <<<<<<<
    Error: no element found
    Source File:

    Line: 1, Column: 1
    Source Code:
    ^
    >>>> End Error Message <<<<<<<
    >>>> Start JavaScript <<<<<<<
    <script language="javas cript" type="text/javascript">
    var result ;
    var http_request = false ;
    var ng= -1 ;
    var reqFlag="availa ble" ;

    function makeRequest(url , parameters) {
    http_request = false;
    if (window.XMLHttp Request) { // Mozilla, Safari,...
    http_request = new XMLHttpRequest( );
    if (http_request.o verrideMimeType ) {
    http_request.ov errideMimeType( 'text/xml');
    }
    } else if (window.ActiveX Object) { // IE
    try {
    http_request = new ActiveXObject(" Msxml2.XMLHTTP" );
    } catch (e) {
    try {
    http_request = new ActiveXObject(" Microsoft.XMLHT TP");
    } catch (e) {}
    }
    }
    if (!http_request) {
    alert('Cannot create XMLHTTP instance');
    return false;
    }
    http_request.on readystatechang e = alertContents;
    http_request.op en('GET', url + parameters, false);
    http_request.se nd(null);
    }

    function alertContents() {
    if (http_request.r eadyState == 4) {
    if (http_request.s tatus == 200) {
    //alert(http_requ est.responseTex t);
    result = http_request.re sponseText;
    RtVal = result;
    } else {
    alert('There was a problem with the request.');
    }
    }
    }

    function wrtmmbr()
    {
    if (vrfd=="submitt ed") {
    alert ("Membership has been approved for "+vunm) ; return; }
    if (vrfd=="yes") {
    vunm = document.crnew. unm.value;
    vpsswrd = document.crnew. psswrd.value;
    veml = document.crnew. eml.value;
    vhsnm = document.crnew. hsfname.value;
    vhrnm = document.crnew. hrfname.value;
    vcty = document.crnew. cty.value;
    vstt = document.crnew. stt.value;

    prm="?unm="+vun m+"&psswrd="+vp sswrd+"&eml="+v eml+"&hsnm="+vh snm+"&hrnm="+vh rnm+"&cty="+vct y+"&stt="+vst t;
    reqFlag="wrtPro file" ; makeRequest('ps cripts/scr0003.php',pr m);
    vrfd="submitted " ;
    alert("Your Membership has been created, please log in.");
    window.open("me mberlogin.html" ,"_self"); }
    }


    function ProcessData()
    {
    switch(reqFlag)
    {
    case 'chkUName' :
    thrspns = result.indexOf( "au~~th");
    if (thrspns>ng) {
    } else
    {
    alert(tmp2+" is not available. Please try again.");
    document.crnew. cunm.focus(); return ;
    }
    break ;
    case 'chkCity' :
    thrspns = result.indexOf( "fou~~und") ;
    if (thrspns<0) {
    alert("We can not find a City named "+tmp2) ;
    document.crnew. stt.focus(); }
    break ;
    case 'wrtPassword' :
    return;
    break ;
    case 'wrtProfile' :
    return;
    break ;
    }
    }
    </script>
    >>>> End JavaScript <<<<<<<
    >>>> Start PHP Script <<<<<<<
    <?php

    $host = "127.0.0.1" ;
    $login = "root";
    $pwd = "AntonMlabe r";
    $port = "3306";
    $db = "mmbrdt";
    $tblnm = "membership " ;
    $lunm = $_REQUEST["unm"];
    $lpsswrd = $_REQUEST["psswrd"];
    $leml = $_REQUEST["eml"];
    $lhsnm = $_REQUEST["hsnm"];
    $lhrnm = $_REQUEST["hrnm"];
    $lcty = $_REQUEST["cty"];
    $lstt = $_REQUEST["stt"];
    $tm = array() ;
    $tm=localtime() ;
    $tday = $tm[3];
    $tmh = $tm[4] ;
    $tmonth = $tmh+1 ;
    $tyr = $tm[5] ;
    $tyear = $tyr+1900;
    $ll=$tyear."-".$tmonth."-".$tday;
    $lsd=$tyear."-".$tmonth."-".$tday;
    $host=$host.":" .(integer)$port ;
    $conn=mysql_con nect($host,$log in,$pwd) or die();
    $sql = "INSERT INTO $tblnm
    (UserName,UserP assword,EmailAd dress,HisFName, HerFName,City,S tate,RegDate,La stLogon,Renewal Date)
    VALUES
    ('$lunm','$lpss wrd','$leml','$ lhsnm','$lhrnm' ,'$lcty','$lstt ','$ll','$ll',' $lsd')";
    mysql_select_db ($db,$conn) ;
    mysql_query($sq l);

    $sql = "SELECT UserName FROM $tblnm WHERE UserName='$lunm '";
    mysql_select_db ($db,$conn) ;
    $ProNum = mysql_query($sq l);

    $host = "127.0.0.1" ;
    $login = "root";
    $pwd = "AntonMlabe r";
    $port = "3306";
    $db = "upw";
    $tblnm = "pwds" ;
    $sql = "INSERT INTO $tblnm (UserID,UserNam e,UserPwd,LastL ogon)
    VALUES ('$ProNum','$lu nm','$lpsswrd', '$ll')";
    mysql_select_db ($db,$conn) ;
    mysql_query($sq l);

    ?>
    >>>> End PHP Script <<<<<<<
  • Andy Hassall

    #2
    Re: 'No element found' error

    On Mon, 21 Aug 2006 14:46:40 -0600, "C.Joseph Drayton" <csdcs@tlerma.c om>
    wrote:
    >I am not sure if this is a JavaScript or PHP error. Basically what
    >is happening, is that I have an HTML page with the following
    >JavaScript. As you can see makeRequest() calls a PHP script which is
    >included below.
    >
    >When the code is executed, I get the following error in FireFox's
    >JavaScript console;
    >
    >>>>> Start Error Message <<<<<<<
    >Error: no element found
    >Source File:
    >http://127.0.0.1:8000/pscripts/scr00...=tacoma&stt=47
    >Line: 1, Column: 1
    >Source Code:
    >^
    >>>>> End Error Message <<<<<<<
    It's a Javascript error, probably from your XMLHTTPRequest, and further
    probably from the request returning an empty string or something non-XML.

    Install a Javascript debugger, such as Firebug [1], which will help you find
    what's actually going on.

    [1] http://www.joehewitt.com/software/firebug/

    Follow-ups set to comp.lang.javas cript.

    --
    Andy Hassall :: andy@andyh.co.u k :: http://www.andyh.co.uk
    http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool

    Comment

    Working...