求助,提交PHP界面,这里哪错了?

wx2016 2016-03-17 09:26:03

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>

<script type="text/javascript">

function ajaxFunction()
{namex()
var xmlHttp;

try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{

// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{

try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("您的浏览器不支持AJAX!");
return false;
}
}
}


xmlHttp.onreadystatechange=function()
{
var xx = document.getElementsByName("username")[0].value;
if (xx == ""){
document.getElementById("user_msg").innerHTML='<font color=red>不能为空!</font>';}
else if(document.getElementById('username').value.length < 6){
document.getElementById("user_msg").innerHTML='<font color=red>不能少于六!</font>';
}else if(xmlHttp.readyState==4)
{
var x = xmlHttp.responseText;//获取传过来的值
if(x == 1){
bb = "1";
document.getElementById("user_msg").innerHTML='<font color=green>√</font>';
}else{document.getElementById("user_msg").innerHTML='<font color=red>用户已经被注册</font>';}
}
}
var name=document.myForm.username.value;
xmlHttp.open("get","<?php echo site_url();?>/user/user_userx/?name="+name,true);//错误跟域名有关系192.168.1.102报错显示没权限 127.0.0.1没报错
xmlHttp.send(null);

}

</script>



</head>

<body>
<form name="myForm" action="/index.php/log/registration" method="post" onsubmit="return check();">
登陆账号:<input name="username" id="username" onblur="ajaxFunction(name);" onkeyup="value=value.replace(/[^\w\.\/]/ig,'')"

</form>






</body>
</html>





哪里错了?

xmlHttp.open("get","<?php echo site_url();?>/user/user_userx/?name="+name,true);//错误跟域名有关系192.168.1.102
/user/user_userx/?name="+name,true)这行代码是什么意思?
...全文
115 回复 打赏 收藏 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

87,984

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧