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 閱讀(365) 評(píng)論(0)  編輯  收藏 所屬分類: Web

          主站蜘蛛池模板: 十堰市| 柯坪县| 米泉市| 扎鲁特旗| 湖南省| 横山县| 万荣县| 罗田县| 商丘市| 当阳市| 汶上县| 上栗县| 台东县| 江门市| 玉林市| 延津县| 禄劝| 平凉市| 威海市| 堆龙德庆县| 寿宁县| 自贡市| 宁晋县| 灌阳县| 大丰市| 大理市| 彰武县| 东至县| 新余市| 龙口市| 郴州市| 宜良县| 印江| 斗六市| 贺兰县| 宁远县| 武平县| 潍坊市| 涞水县| 合水县| 永丰县|