注册 登录
编程论坛 ASP技术论坛

函数调用问题

yaopeng0418 发布于 2010-09-01 16:24, 656 次点击
Response.Write("<div  id='me' style='background-color:#FFFFFF;' onMouseOver='this.style.background-color='#F0F5F8';'  onMouseOut='this.style.background-color='#FFFFFF''><a href=# style='margin-left:8px;'><img src="&rs4("hpicture")&" name="&session("name1")&"  onclick='send(this.name);' onLoad='head(this.name,this)'  align='absmiddle' style='border:0px solid #CCFFFF;' onMouseOut='this.width=40;this.height=40' onMouseOver='DrawImage(this)' width='40' height='40'></a>div>")
但是onload没反应,head函数如下:
function head(name,hpic){
alert(pic);
window.setTimeout("head(name,hpic)",50);
createXMLHttpRequest();
xmlhttp.onreadystatechange=onhback(hpic);
var url="pic.asp?name="+escape(name);
xmlhttp.open("GET",url,true);
xmlhttp.setRequestHeader("Content-Type","application/x-www-form-encoded");
xmlhttp.send(url);
}

function onhback(hpic)
{
if(xmlhttp.readyState==4)
{
if(xmlhttp.status==200)
{
  var cont=unescape(xmlhttp.responseText);
  $(hpic).attr("src",cont)
}

}
}
希望大家能帮忙解决一下
3 回复
#2
wangjy5002010-09-01 20:32
alert(pic);
这句看看
#3
yaopeng04182010-09-01 20:45
没反应
#4
fengmumei2010-09-02 17:03
因为你只发了一部分代码,所以也没有办法根据你发的信息进行测试,我只能给你个建议,你自己试试看。
首先你要确定你的Response.Write()里的代码是否正确,你可以把head()函数写的简单些,例如:
function head(name,hpic){
alert("1");}
如果确定response.write()输出的信息正确,再一步步测试你的head()函数。

1