函数参数传入子函数不成功,请问怎么回事

aessjz 2009-03-27 05:02:53
function getComPage(classid,id,pagenum){
var url = '/e/ajax/index.php?';
var params ='action=getComPage' + '&classid=' + classid + '&id=' + id + '&pagenum=' + pagenum;
url+=params;
var functionName=function (classid,id,pagenum){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
if(xmlHttp.responseText!=0){
$(".comnav1").html(xmlHttp.responseText);
getComList(classid,id,pagenum);
}
else {
$(".comnav1").html("");
}
}
else if(xmlHttp.readyState!=4)
{
loadING("#commentinfo");
}
}
};
makeRequest(url, functionName, "GET", '');
}


我这样写,可是var functionName=function (classid,id,pagenum)中的3个参数并没有顺利地传入函数里(注:这里传入参数主要是让getComList(classid,id,pagenum)用的),可是现在提示getComList(classid,id,pagenum)都是空,即没有被顺利赋值

当然前提是不改变functionName,他就是一个字符串,

请问该怎么改,谢谢
...全文
123 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
ohmydog1 2009-03-27
  • 打赏
  • 举报
回复

function getComPage(classid,id,pagenum){
var url = '/e/ajax/index.php?';
var params ='action=getComPage' + '&classid=' + classid + '&id=' + id + '&pagenum=' + pagenum;
url+=params;
var functionName=function (){
temp(classid,id,pagenum);
};
makeRequest(url, functionName, "GET", '');
}
function temp(classid,id,pagenum){
if(xmlHttp.readyState==4){
if(xmlHttp.status==200){
if(xmlHttp.responseText!=0){
$(".comnav1").html(xmlHttp.responseText);
getComList(classid,id,pagenum);
}
else {
$(".comnav1").html("");
}
}
else if(xmlHttp.readyState!=4)
{
loadING("#commentinfo");
}
}
}

87,910

社区成员

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

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