就像这是我表单的选择框
<select name="cutid" onchange="findcustid(this.value)">
<option value="1001">cust 1</option>
<option value="1002">cust 2</option>
<option value="1003">cust 3</option>
</select>
现在我有这个 ajax 代码正在传递并填充一些选择框
function findcustid(custid) {
var custid = custid;
}
function Inint_AJAX() {
try {
return new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {} //IE
try {
return new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {} //IE
try {
return new XMLHttpRequest();
} catch (e) {} //Native Javascript
alert("XMLHttpRequest not supported");
return null;
};
function dochange(src, val) {
var req = Inint_AJAX();
req.onreadystatechange = function () {
if (req.readyState == 4) {
if (req.status == 200) {
document.getElementById(src).innerHTML = req.responseText; //retuen value
}
}
};
req.open("GET", "podetfill.php?data=" + src + "&val=" + val + "&custid=" + custid); //make connection
req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded;charset=iso-8859-1"); // set Header
req.send(null); //send value
}
window.onLoad = dochange('proid', -1); // value in first dropdown
在这条线上
req.open("GET", "podetfill.php?data="+src+"&val="+val+"&custid="+custid);
上面的代码我已经添加了这个,但它没有在页面上+"&custid="+custid
传递值并出现错误custid
podetfill.php
Error: custid not defined