this

    1熱度

    6回答

    我已經創建了一個CalendarViewerPortlet自定義對象JS對象。在這個對象中,我存儲了諸如portlet的id和上下文路徑之類的東西。該對象還有許多自定義方法,其中一些用於獲取/設置成員變量,另一些用於執行特定的事情。 當我嘗試使用「this」引用對象的函數時。在jQuery函數中,它爆炸了。我知道在這種情況下,術語「這個」可能指的是別的東西,但我不確定如何解決問題並讓它參照對象,就

    10熱度

    6回答

    如何傳遞這個(self關鍵字)在$一個函數在jQuery中 $(document).ready(function() { $('.nav a').click(function() { var direction = $(this).attr("name"); submit_form($(this)) }); function submit_

    4熱度

    2回答

    這裏是用作事件處理功能,使得使用的this: function validate() { if (this.val() == '') { return false; } } $(':input').change(validate); 這裏的改寫,以一個參數相同的功能,這樣我可以明確地稱之爲: function validate(field) { i

    2熱度

    1回答

    我不能得到模糊()函數以下工作: $('.newselect').focus(function(){ $(this).parent().append('<div class="select_container"></div>'); }); $('.newselect').blur(function(){ $(this).parent().remove('.select_co

    1熱度

    1回答

    這可能是通過一些代碼最好的解釋。我知道在下面的例子中,addEvent方法中的this是數組elements中包含的當前元素。 var testClass = new Class({ testMethod: function() { var elements = $$('.elements'); elements.addEvent('click', functio

    0熱度

    1回答

    我在CakePHP的一個新的,我找的一些代碼,我已經下載的功能,看起來象下面這樣: $this->set(array('fruit' => 'orange', 'vegetable' => 'kale')); 在代碼中,數組變量是在另一個控制器功能使用此訪問方法: $varsSet = $this->viewVars; echo $varsSet['vegetable']; 我想什麼做訪

    4熱度

    2回答

    有時它可以在實例成員混亂閱讀代碼,是指同一類的其他實例成員(或基類): public void MyMethod() { Where = did + AllTheseWeirdThings(GetDeclared()); // ? } 有一個編碼標準像「前綴與所有私人/ protected成員「_」沒有幫助,因爲實例成員仍然可以參照公共成員 這將是更好的閱讀本: public v

    2熱度

    7回答

    class Person { string name; public Person(string name) { this.name = name; } public void method() { Person gupta = new Person("James"); // Current Object

    3熱度

    1回答

    我知道'this'在封閉內外有所不同。 但爲什麼numChildren和this.numChildren在閉包內部有所不同? 或者爲什麼numChildren在外部和內部是相同的? var _this:Sprite = this; trace("[outside]this: " + this); trace("[outside]numChildren: " + numChildren); t

    0熱度

    1回答

    下面的工作正常。但是,我有2個子菜單​​ - 如果我將鼠標懸停在其中,他們的兩個孩子「ul.menu_body」都會淡入。 大概我需要在某處使用「this」,所以淡入淡出只適用於所需的菜單。 我嘗試添加 $( 「ul.menu_body」,這一點).fadeIn( '快') 但這停止它完全工作 - 沒有錯誤的心(我可以看到) 什麼想法?謝謝。 $(document).ready(function(