Results 1 to 9 of 9

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763

    JavaScript ( )

    , :
    Code:
    var SimpleContextMenu = {
      ...
      setup : function() {
        ...; document.oncontextmenu = SimpleContextMenu._show;
        document.onclick = SimpleContextMenu._hide; ...
      }
      _show : function() { this.hide(); ... }
      _hide : function() { ... }
      ...
    }
    
    SimpleContextMenu.setup;
    , . :

    Code:
    function SimpleContextMenu() {
      ...
      this.setup = function () {
        ...; document.oncontextmenu = this._show;
        document.onclick = this._hide; ...
      }
      this._show = function() { this._hide(); ... }
      this._hide = function() { ... }
      ...
    }
    
    var cm = new SimpleContextMenu();
    cm.setup;
    (document.oncontextmenu), ( ): "this._hide() is not a function". _hide() setup() - !

    ? , , . .
    (10b) || !(10b)

  2. #2
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    _hide _show.
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

  3. #3
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763
    Quote Originally Posted by Bombera View Post
    _hide _show.
    - ...
    (10b) || !(10b)

  4. #4
    Registered User
    Join Date: Aug:2006
    Location: Sofia
    Posts: 37
    :

    Code:
    ...
    var self = this;
    this._show = function() { self._hide(); ... }
    this._hide = function() { ... }
    ...

  5. #5
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763
    Quote Originally Posted by sunless View Post
    :

    Code:
    ...
    var self = this;
    this._show = function() { self._hide(); ... }
    this._hide = function() { ... }
    ...
    .
    , , document.oncontextmenu this "instance of the SimpleContextMenu object", document. ...
    (10b) || !(10b)

  6. #6
    Bombera's Avatar
    Join Date: Jul:2001
    Location: 4EVA
    Posts: 13,833
    , , this _hide _show , document. , ,

    .. !
    this
    Code:
    for(i in this)
    alert(i+":"+i[this]);
    , document.

    , , .
    EVGA X299 FTW K|i9-7960X@4.7|4x8 Patriot Viper Steel 4000|GTX 1660 Ti|970 EVO 1 TB|Seasonic Focus GX-1000|Xigmatek Elysium|
    Rampage IV Extreme BE|E5-1680v2@4.7|4x4 HyperX 1866|Cougar Aqua 240|GTX 1050 Ti|970 EVO 1/4 TB|CM 850 SilentPro|HAF-X|

  7. #7
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763
    _hide() - "SimpleContextMenu._hide()", "this._hide()". .

    Quote Originally Posted by Bombera View Post
    , , .
    , ... , , "" ( JavaScript , ).

    .
    (10b) || !(10b)

  8. #8
    Registered User
    Join Date: Jul:2005
    Location: Sofiq
    Posts: 2,798

    Thumbs up

    oThis = this :
    Code:
    function SimpleContextMenu() {
    var oThis = this;
    this._show = function() { oThis._hide(); ... } //  this       
    this._hide = function() { ... }
    }
    . IE? .
    Code:
    document.oncontextmenu = function (e) {
    if (!e) e = window.event;
    if(e.preventDefault)  e.preventDefault();
    e.cancelBubble = true;//IE  :)
    oThis._show();
    };
    Last edited by _ShadoW_; 11th December 2008 at 17:09.

  9. #9
    Mire-x
    Join Date: Apr:2005
    Location: Sofia
    Posts: 763
    - , .
    (10b) || !(10b)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |