大家看下我哪里写的有问题了老报如下错误:
“完成该操作所需要的数据还不可使用”
以下是js程序代码var xmlHttp;
function S_xmlhttprequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');
}else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}function funphp100(url){
S_xmlhttprequest();
xmlHttp.open("GET","for.php?id="+url,true); //传值
xmlHttp.onreadystatechange= byphp; //调用byphp这个方法
xmlHttp.send(null);
}function byphp(){
var byphp100 = xmlHttp.responseText;
document.getElementById('php100').innerHTML = byphp100;
}以下是PHP程序代码:index.php<script type="text/javascript" src="ajax.js"></script>
<a href="#" onclick="funphp100('q')">q</a>
<a href="#" onclick="funphp100('t')">t</a>
<a href="#" onclick="funphp100('x')">x</a><div id="php100"></div>以下是循环显示页面:for.php<?php
if ($o= $_GET['id']) {
for ($i=1;$i<=10;$i++){
echo $o;
}
}
?>
“完成该操作所需要的数据还不可使用”
以下是js程序代码var xmlHttp;
function S_xmlhttprequest(){
if(window.ActiveXObject){
xmlHttp=new ActiveXObject('Microsoft.XMLHTTP');
}else if(window.XMLHttpRequest){
xmlHttp=new XMLHttpRequest();
}
}function funphp100(url){
S_xmlhttprequest();
xmlHttp.open("GET","for.php?id="+url,true); //传值
xmlHttp.onreadystatechange= byphp; //调用byphp这个方法
xmlHttp.send(null);
}function byphp(){
var byphp100 = xmlHttp.responseText;
document.getElementById('php100').innerHTML = byphp100;
}以下是PHP程序代码:index.php<script type="text/javascript" src="ajax.js"></script>
<a href="#" onclick="funphp100('q')">q</a>
<a href="#" onclick="funphp100('t')">t</a>
<a href="#" onclick="funphp100('x')">x</a><div id="php100"></div>以下是循环显示页面:for.php<?php
if ($o= $_GET['id']) {
for ($i=1;$i<=10;$i++){
echo $o;
}
}
?>
<?
session_start();
$myCxmis = new Cxmis;
if($mysubmit =="确定"){
$result = $myCxmis->register($username,$password);
if($result==2){
$uid=$username;
session_register('uid'); ?>
<script language="javascript">
alert("注册成功");
window.location='ywsljj.php';
</script>
<?
}else if($result==1){
?>
<script language="javascript">
alert("此用户名已经存在,请重新注册");
window.location='javascript:history.back(-1)';
</script>
<?
}else{
?>
<script language="javascript">
alert("注册失败,请重新注册");
window.location='javascript:history.back(-1)';
</script>
<?
}}else {
?>
<html> <head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title> </title>
</head>
<script language="Javascript" src="/script/checkpassword.js"> </script>
<script language="Javascript" src="/script/ajaxreg.js"> </script>
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0"> <div align="left">
<table border="0" width="100%" cellspacing="0" cellpadding="0" id="table1"> <?
require("./include/top.inc");
?> <tr>
<td align="left" valign="top">
<table border="0" width="100%" id="table3" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top" width="235">
<table border="0" width="100%" id="table19" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"> </td>
</tr>
<tr>
<td>
<img border="0" src="images/zjcx_ml_11_01.gif" width="235" height="166"> </td>
</tr>
</table>
</td>
<td align="left" valign="top">
<table border="0" width="100%" id="table14" cellspacing="0" cellpadding="0">
<tr>
<td width="22">
<img border="0" src="images/zjcx_07_01.gif" width="22" height="16"> </td>
<td background="images/zjcx_07_02.gif">
<img border="0" src="images/zjcx_07_02.gif" width="745" height="16"> </td>
</tr>
<tr>
<td background="images/zjcx_07_03.gif" height="380" width="22">
<img border="0" src="images/zjcx_07_03.gif" width="22" height="50"> </td>
<td align="left" valign="top">
<table border="0" width="100%" id="table15" cellspacing="0" cellpadding="0">
<tr>
<td>
<p align="center">帐 号 注 册
<!--img border="0" src="images/zjcx_07_04_01.gif" width="745" height="35"--> </td>
</tr>
<tr>
<td>
<table border="0" width="100%" id="table16" cellspacing="0" cellpadding="0">
<tr>
<td width="363">
<img border="0" src="images/zjcx_07_08_01.gif" width="363" height="17"> </td>
<td background="images/zjcx_07_08_02.gif">
<img border="0" src="images/zjcx_07_08_02.gif" width="9" height="17"> </td>
<td width="373">
<img border="0" src="images/zjcx_07_08_03.gif" width="373" height="17"> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td align="center">
<table border="0" width="98%" id="table18" cellspacing="0" cellpadding="0">
<tr>
<td>
<form name=reg method=post action="/register.php" onsubmit="return checkpwd(this)">
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#9ad0eb">
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#9ad0eb" width="100%">
<tr bgcolor="#e4f2fa"> <td colspan=3>帐号注册 </td> </tr>
( * 为必填项)
<tr bgcolor="#e4f2fa">
<td >
<div align="center">用户名 <font color="#FF0000">* </font> </div>
</td>
<td >
<input type="text" name="username" id="username" size="25" maxlength="15" onBlur="return usercheck('check')">
</td>
<td align="left" bgcolor="#FFFFFF"> <!--input type=button value='检查用户名' onclick="return usercheck('check')"--> <span id="check"> 3-16个字符,英文小写、汉字、数字、最好不要全部是数字。 </span> </td> </tr>
<tr bgcolor="#e4f2fa">
<td >
<div align="center">密码 <font color="#FF0000">* </font> </div>
</td>
<td >
<input type="password" name="password" id="userpwd" onBlur="pwdcheck('pwd')">
</td>
<td align="left" bgcolor="#FFFFFF" id="pwd"> 密码字母有大小写之分。6-16位(包括6、16),限用英文、数字。 </td> </tr>
<tr bgcolor="#e4f2fa">
<td >
<div align="center">确认密码 <font color="#FF0000">* </font> </div>
</td>
<td >
<input type="password" name="checkpassword" id="reuserpwd" onBlur="pwdrecheck('repwd')">
</td>
<td align="left" bgcolor="#FFFFFF" id="repwd"> 请再次输入登录密码。 </td>
</tr>
<tr bgcolor="#e4f2fa"> <td colspan=3 align="center">
<input type="submit" name=mysubmit value="确定">
<input type=reset value="重填">
</td> </tr>
</table>
</form> <!--文字内容结束--> </td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" width="100%" id="table17" cellspacing="0" cellpadding="0">
<tr>
<td width="363">
<img border="0" src="images/zjcx_07_08_01.gif" width="363" height="17"> </td>
<td background="images/zjcx_07_08_02.gif">
<img border="0" src="images/zjcx_07_08_02.gif" width="9" height="17"> </td>
<td width="373">
<img border="0" src="images/zjcx_07_08_03.gif" width="373" height="17"> </td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr> <?
require("./include/bottom.inc");
?> </table>
</div> </body> </html>
<?
}
$myCxmis->Destroy();
?>
var http_request=false;
function send_request(url){//初始化,指定处理函数,发送请求的函数
http_request=false;
//开始初始化XMLHttpRequest对象
if(window.XMLHttpRequest){//Mozilla浏览器
http_request=new XMLHttpRequest();
if(http_request.overrideMimeType){//设置MIME类别
http_request.overrideMimeType("text/xml");
}
}
else if(window.ActiveXObject){//IE浏览器
try{
http_request=new ActiveXObject("Msxml2.XMLHttp");
}catch(e){
try{
http_request=new ActiveXobject("Microsoft.XMLHttp");
}catch(e){}
}
}
if(!http_request){//异常,创建对象实例失败
window.alert("创建XMLHttp对象失败!");
return false;
}
http_request.onreadystatechange=processrequest;
//确定发送请求方式,URL,及是否同步执行下段代码
http_request.open("GET",url,true);
http_request.send(null);
}
//处理返回信息的函数
function processrequest(){
var mess
if(http_request.readyState==4){//判断对象状态 if(http_request.status==200){//信息已成功返回,开始处理信息
if(http_request.responseText=='exist')
mess=" <font color=red>此用户名已经存在,请更换用户名! </font>";
else if(http_request.responseText=='ok')
mess=" <font color=red>此用户名可以注册 </font>";
else if(http_request.responseText=='right')
mess=" <font color=red>旧密码正确 </font>";
else if(http_request.responseText=='error')
mess=" <font color=red>旧密码不正确 </font>";
document.getElementById(reobj).innerHTML=mess;
}
else{//页面不正常
alert("您所请求的页面不正常!");
}
}
}
function usercheck(obj){
var f=document.reg;
var username=f.username.value;
if(username==""){ document.getElementById(obj).innerHTML=" <font color='#ff0000'>用户名不能为空! </font>";
//f.username.focus();
//return false;
}
else if(username.replace(/[^\x00-\xff]/g,'##').length>16){
document.getElementById(obj).innerHTML=" <font color=red>用户名长度不能大于16位(汉字不能超过8个)! </font>";
//f.userpwd.focus();
return false;
}
else{
document.getElementById(obj).innerHTML="正在读取数据...";
send_request('checkuserreg.php?username='+username);
reobj=obj;
}
}
function userpwdcheck(obj){
var f=document.reg;
var oldpassword=f.oldpassword.value;
if(oldpassword==""){ document.getElementById(obj).innerHTML=" <font color='#ff0000'>旧密码不能为空! </font>";
//f.username.focus();
//return false;
}
else{
document.getElementById(obj).innerHTML="正在读取数据...";
send_request('checkuserpwd.php?oldpassword='+oldpassword);
reobj=obj;
}
}
function pwdcheck(obj){
var f=document.reg;
var pwd=f.userpwd.value;
if(pwd==""){
document.getElementById(obj).innerHTML=" <font color=red>用户密码不能为空! </font>";
//f.userpwd.focus();
return false;
}
else if(f.userpwd.value.length <6){
document.getElementById(obj).innerHTML=" <font color=red>密码长度不能小于6位! </font>";
//f.userpwd.focus();
return false;
}
else{
document.getElementById(obj).innerHTML=" <font color=red>密码符合要求! </font>";
}
}
function pwdrecheck(obj){
var f=document.reg;
var repwd=f.reuserpwd.value;
if (repwd==""){
document.getElementById(obj).innerHTML=" <font color=red>请再输入一次密码! </font>";
//f.reuserpwd.focus();
return false;
}
else if(f.userpwd.value!=f.reuserpwd.value){
document.getElementById(obj).innerHTML=" <font color=red>两次输入的密码不一致! </font>";
//f.reuserpwd.focus();
return false;
}
else{
document.getElementById(obj).innerHTML=" <font color=red>密码输入正确! </font>";
}
}
<a href="#" onclick="funphp100('q')">q</a>
<a href="#" onclick="funphp100('t')">t</a>
<a href="#" onclick="funphp100('x')">x</a>
<div id="php100"></div>funphp100('q')函数参数是否正确?我自己人认为应该是数字,要不然$o= $_GET['id']赋值为0,所以循环就不执行,也就没返回信息
function byphp(){
if(xmlHttp.readyState==4){
var byphp100 = xmlHttp.responseText;
document.getElementById('php100').innerHTML = byphp100;
}
}