Siri: Neues JS-Objekt innerhalb eines Scopes?

Beitrag lesen

Du machst folgendes:
<html>
  <head>
    <title>test</title>
  </head>
  <body>
    <script type="text/javascript">
      var xxx = {
        xxx: "xxx",
        func: function()
        {
          alert(this.xxx)
          alert(this.yyy)
        }
      }
      var yyy = {
        yyy: "yyy"
      };
      yyy.func = xxx.func;
      yyy.func();
    </script>
  </body>
</html>

I'm sorry, aber ich kann dir einfach nicht folgen, weil ich doch das mache:

<html xmlns="http://www.w3.org/1999/xhtml">  
  <head>  
    <meta charset="utf-8"/>  
    <title></title>  
  </head>  
  <body>  
    <!-- ====================== -->  
    <ul id="wrapper1" class="changeposul">  
      <li id="fd1">a1</li>  
      <li id="fd2">a2</li>  
      <li id="fd7">a7</li>  
    </ul>  
    <!-- ====================== -->  
    <ul id="wrapper2" class="changeposul">  
      <li id="fda">a1</li>  
      <li id="fdb">a2</li>  
    </ul>  
    <!-- ====================== -->  
    <script>
  
var MyFW = (function () {  
  
  function init() {  
    var changePosULsArray = document.getElementsByClassName('changeposul');  
    for (var y= 0; y < changePosULsArray.length; y++) {  
      var liChangePosHandlerLoop = new LiChangePosHandler();  
      liChangePosHandlerLoop.init(y);  
      changePosULsArray[y].addEventListener("click", liChangePosHandlerLoop.moveUp,  false);  
    }  
  }  
  
  return {  
    afterLoad: function() {  
      init();  
    }  
  }  
  
  function LiChangePosHandler() {  
  
    var moveInProgress;  
    var moveCounter;  
  
    this.init = function (counter) {  
      moveInProgress = false;  
      moveCounter = counter;  
    };  
  
    this.moveUp = function (eventObject) {  
      alert(moveInProgress+"|"+moveCounter);  
      if (moveInProgress == false) {  
        moveInProgress = true;  
        // Do anything  
      }  
    };  
  
  }  
  
})();  
myContentLoaded (window, MyFW.afterLoad ); 
    </script>  
  </body>  
</html>

Da fehlt mir jetzt echt das Wissen um deine Angabe oben mit meiner Angabe unten zu vergleichen.