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

          My Links

          Blog Stats

          常用鏈接

          留言簿(5)

          隨筆分類

          隨筆檔案

          文章分類

          java

          Javascript

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 安义县| 竹北市| 柞水县| 靖西县| 彰武县| 三明市| 涿州市| 衡阳县| 张家口市| 怀集县| 九寨沟县| 金秀| 沙田区| 黑龙江省| 连江县| 霞浦县| 准格尔旗| 丽水市| 凉城县| 南投市| 麻江县| 兖州市| 麻城市| 顺昌县| 黎城县| 黄陵县| 项城市| 鹤岗市| 英吉沙县| 永平县| 铜山县| 梅州市| 平利县| 安吉县| 增城市| 潞西市| 特克斯县| 博客| 太湖县| 丹阳市| 许昌县|