document.getElementById(id)\n"; 如果是想获取传递过来的id的对象就不用要用"'"单引号应该你是想取值吧
$OUTPUT .=" var uid= document.getElementById(id).value\n";
$OUTPUT .=" alert(uid)\n";
$OUTPUT .=" var imgWindow = window.open('windows_pri?uid='+uid, 'windows', 'width=320,height=240,scrollbars=no')\n"; windows_pri.php里面:
$uid = $_GET['uid'];
$OUTPUT .=" var uid= document.getElementById(id).value\n";
$OUTPUT .=" alert(uid)\n";
$OUTPUT .=" var imgWindow = window.open('windows_pri?uid='+uid, 'windows', 'width=320,height=240,scrollbars=no')\n"; windows_pri.php里面:
$uid = $_GET['uid'];
或者在form里头弄个hidden,在post form时候就把这个变量传回去了,(这招比较麻烦,而且要有用form时候才好用)
var subTag = false;
function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}
function startRequest(o){
createXMLHttpRequest();
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET","checkCode.php?codes="+o,true);//这里get方式传值
xmlHttp.setRequestHeader("If-Modified-Since","0");
xmlHttp.send(null);
} function handleStateChange()
{
if(xmlHttp.readyState==4){
if(xmlHttp.status == 200){
if(xmlHttp.responseText == 'false'){
alert("验证码不正确");
subTag = false;
}else{
document.form1.submit();
subTag = true;
}
}
}
}
function checkAdd(){
var o = document.getElementById("checkCode");
startRequest(o.value);
return subTag;
}