What are the common errors of Javascript in IE ?? The object is missing! JavaScript php lacks objects
Query0 = mssql_query ("select * from tb_xm where xm_pcid = '1 '");
$ Y = 1;
While ($ myrow0 = mssql_fetch_array ($ query0 )){
?>
Function datawrite (){
If (xmlHttp. readyState = 4 | xmlHttp. readyState = 0 ){
XmlHttp. open ("GET", "kspf_conn1.php? Online_xm = "+" "+" & Online_user = "+" "+" & Online_ytbyx = "+ ytbyx +" & online_mbnr = "+ mbnr +" & Signature = "+ zjzb +" & online_ffjs = "+ ffjs +" & online_xyqj = "+ xyqj + "& online_jdjf =" + jdjf + "& online_zhpf =" + zhpf + "& online_sum =" + sum, true );
XmlHttp. send (null );
} Else {
The xmlHttp object in alert ("datawrite () is busy! ");
SetTimeout ('datawrite () ', 1000 );
}
}
Datawrite ();
}
?>
In the above code, the information in the project table is read cyclically and kspf_conn1.php is opened in XML to enter the database. after checking that the kspf_conn1.php file is correct. However, after you enter the preceding program, the error message "object missing" appears. the online_xm value indicates the project name. after you enter the database, you can see that the names of all projects are changed to the names of the last project. Why should I write different project names?
Reply to discussion (solution)
Where is the xmlHttp object defined?
I loaded a js script at the beginning of php and skipped it here.
Js errors should be checked on the generated page
You define the js function datawrite in the loop. (). Because $ y does not change in the loop, it just repeats the definition of the datawrite1 function. Naturally, only the last round of definition will take effect.
I have solved it myself. it turns out that there is still the xmlhttp lifecycle issue out of the suggestion on the third floor. we should declare the xmlHttp object before each usage, because it is used cyclically here, loading at the beginning of the file will result in an error!