thinking

one platform thousands thinking

Type mismatch in IE

A:
I am writing an AJAX application.

Here is a piece of my code:

http.open("GET", fullURL, true);
http.onreadystatechange = handleHttpResponse;

the handleHttpResponse is the function that processes the returned data.

If I wanted to pass a string in to handleHttpResponse, I use:

= handleHttpResponse(user_name);

function handleHttpResponse_remtrip(string) {
alert(string);
.. other code ..
}

This generates a "Type mismatch" error. What gives?


B:
if you do this:

http.onreadystatechange = handleHttpResponse(user_name);

then you are assigning the returned value of handleHttpResponse and not the function itself.

You could try this:

http.onreadystatechange = createFunc(user_name);

function createFunc(v) {
return function() {
alert(v);
}
}

posted on 2011-01-26 11:35 lau 阅读(338) 评论(0)  编辑  收藏 所属分类: Web


只有注册用户登录后才能发表评论。


网站导航: