×

Loading...
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。
Ad by
  • 最优利率和cashback可以申请特批,好信用好收入offer更好。请点链接扫码加微信咨询,Scotiabank -- Nick Zhang 6478812600。

好砖,做台阶用: 你的回贴启发了我,问题解决了: Send portlet name to server, and server sends name back to browser !!!. So for example, see the post I attach here, if you click business name,

customer review and business info will be retrieved independently using the same ajax function sets.
Report

Replies, comments and Discussions:

  • 工作学习 / 学科技术讨论 / javascript问题:代码中的冒号“:”是什么作用?在文档中找不到这样的用法.
    sorttable = {
    init: function() {
    .....
    },

    makeSortable: function(table) {
    .....
    },

    guessType: function(table, column) {
    ....
    },
    ..
    }
    • check JSON. it is something like . in java. Ex: People.run= thisRunFunction(){}
      • 果然有高人。再请问一下所有浏览器都直接支持JSON吗?还是要加载一些framework?
    • 蠢猪,这都不会?不会没关系,Google该会吧?算了,今天大爷我高兴,教你娃两把刷子。新创建一个叫sorttable的对象(object instance 懂不?)。这个对象有三个属性init,makeSortable 和 guessType,并且这三个属性都是函数(function)。
      调用函数举例:

      sorttable.guessType(table, column);

      冒号是创建新对象时用来给属性赋值的。例:

      var stupidObject = {
      name: "yesiam",
      nickName: "party time",
      age: 21,
      gender: "male",
      saySomthing: function {
      alert("I'm really stupid");
      }
      };
      • mark
      • 你这个sorttable跟后面的stupidObject有什么关系啊?小的要问错了,大爷你莫怪.. 小的自动自觉call 100次stupidObject.saySomething().
        • LOL. 没关系。sorttable是他的原例,后面的是我举的蠢例,包括普通属性和函数,更像一个通常用到的对象。
          既然你如此好学,我就在多说几句吧。以上stupidObject 对象有可以用下面几句话来产生:

          var stupidObject = new Object(); // 或者最简单 var stupidObject = {};
          stupidObject.name = "yesiam"; // 或者 stupidObject[name] = "yesiam";
          stupidObject.nickName = "party time";
          stupidObject.age = 21;
          stupidObject.gender = "male";
          stupidObject.saySomthing = function() {
          alert("I'm really stupid");
          };

          // 前面举例时忘了function后的括号()

          想学好JavaScript,还是花点银子去买本书吧。只有一本书值得推荐(其它的都是垃圾):JavaScript: The Definitive Guide
          by David Flanagan

          Google Book 里有些免费章节:
          • 大爷虽然脾气暴躁, 但终归就底还是一个热心肠的人啊
          • 牛X轰轰的!:-)问你一个问题,试过在一个网页里(no iframe),同时evoke多个ajax calls, 更新多个portlets?
            • 牛来了!我闪!
            • 问题我就没看懂.啥意思您呐?
              • 大板砖尽管砸! 今年我要铺后院. You can only issue ajax call once at a click. that ajax call has to handle refresh for all components you want. Inside one html body, ajax is not designed thread safe !!!
                initRequest(), req.onreadystatechange,,,, they are all globals.
                • You can only issue ajax call once at a click. -- 为什么?这跟你上面说的又有什么关系?没有那些狗P函数,没有click也能做很多事情。这就是我之前说你“简单问题复杂化”的原因。
                  • +1砖. what i want to do is server dynamically assigns number of to-be-updated portlet's names to a click event when builds a html page, so I want ajax funcs to be written as general as possible, you know framework template is complicated...?
                    when framework is well built, any app can be built by designing style sheets and one can be done within a day. I can then hire designers with basic html skills instead of programmers, who cost more of course.
                    • "server dynamically assign ......" AJAX的作用是pull (from the server),不是(server) push (to the client)!
                      • You are so out !!! I am saying dynamically creating ajax code on server side before it was sent to client !!!!
                        • 圈子越绕越大,越绕越远。真是吃饱了撑的。没话讲。
                • "they are all globals", i feel a little bit different. the reason is the secod callback object overwrite the first one. to fix this, this artical will help.
                  • 好砖,做台阶用: 你的回贴启发了我,问题解决了: Send portlet name to server, and server sends name back to browser !!!. So for example, see the post I attach here, if you click business name,
                    customer review and business info will be retrieved independently using the same ajax function sets.
            • 又要XB自己造的函数库了?唉~~~
      • you are so mean.
        • 保留点幽默感好不好。我看他自己一边写贴子一边在乐呵呵笑着呢。:D
    • In JavaScript, this is called Object literal. A way for creating an object.
      eg.
      var point = { x:0, y:0 }; // Create object point which with 2 properties

      So for your codes, it means create a sorttable object, and it has many methods like guessType, makeSortable ....

      It is core JavaScript, all major browsers support it.


      sorttable = {
      init: function() {
      .....
      },

      makeSortable: function(table) {
      .....
      },

      guessType: function(table, column) {
      ....
      },
      ..
      }