Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder jfreak53's Avatar
    Join Date
    May 2004
    Location
    Guatemala
    Posts
    477
    Thanks
    19
    Thanked 10 Times in 10 Posts

    [MooTools] - Restart window.addEvent

    Ok got a question for you JS guys. I am of course using mootools in a new project. The problem is I use on some pages a ajax get command to update a DIV on my page so I don't have to re-load whole page. The problem with this is I also use mootips on my page, so when I initially load the page up it works. But when I reload the DIV content using ajax the div tips don't work, since the dom event was for the whole page not just that div.

    So I thought, what if I add that JS code to the returned HTML for the DIV. This works, but only when called of course. If it's there double for instance, since it's the same PHP function I call when initial page load and when DIV load it breaks.

    So real simple, is there a way to re-initialize this event to recheck the whole page for those tips?

    Here is the dom event, it's the typical mootools:

    Code:
    <script type="text/javascript">window.addEvent('domready', function(){
       var Tips1 = new Tips($$('.Tips1'));
    });</script>
    "FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
    http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
    http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
    http://www.microtronix-tech.com -- Web design and programming

  • #2
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by jfreak53 View Post
    Here is the dom event, it's the typical mootools:
    What makes you think we all use or know what MooTools do? I will move your thread to the javaScript Frameworks section.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #3
    Regular Coder jfreak53's Avatar
    Join Date
    May 2004
    Location
    Guatemala
    Posts
    477
    Thanks
    19
    Thanked 10 Times in 10 Posts
    Umm I don't know, just thought that since it was JS based someone here might know something hmmm. Thanks for the move, it was late and wasn't paying attention.
    "FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
    http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
    http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
    http://www.microtronix-tech.com -- Web design and programming

  • #4
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by jfreak53 View Post
    Umm I don't know, just thought that since it was JS based someone here might know something.
    Yeap. Let's hope someone might have worked with MooTools. This is the reason for this movement.

    For me, I don't need JavaScript frameworks/libraries. For me, they do much more harm than help. I prefer to code myself whichever I need.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #5
    Regular Coder jfreak53's Avatar
    Join Date
    May 2004
    Location
    Guatemala
    Posts
    477
    Thanks
    19
    Thanked 10 Times in 10 Posts
    Ha ha well I suck at JS, not suck but it's not my language, so I like it, so there ha ha

    At any rate I figured it out, it's not really a mootools problem since the window.addevent is a JS command I think more than a mootools, I could be wrong.

    At any rate it was late last night and I wasn't thinking straight. All I had to do was move what the addevent command did into a function and then place a call to that function inside my ajax get script so when it returned after it updated the innerHTML of the DIV it just recalled the tips command and refreshed the tips on the whole page. It's working now. So at any rate we are good now, thanks to anyone who might have looked at this.
    "FORTRAN is not a language. It's a way of turning a multi-million dollar mainframe, into a $50 programmable scientific calculator."
    http://www.microfastcat.com -- FastCat Software, the fastest software on the NET!
    http://www.microthosting.com -- Free reseller web hosting, Hosting, VPS, FREE SMALL HOSTING!!!
    http://www.microtronix-tech.com -- Web design and programming

  • #6
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Quote Originally Posted by jfreak53 View Post
    it's not really a mootools problem since the window.addevent is a JS command I think more than a mootools, I could be wrong.
    And you are wrong. First: JavaScript has no commands, it has methods/functions. Second, there is no addevent method in JavaScript. There are 2 event model registrations, one for IE, the other is for the rest of the browsers, DOM compliant.

    See also:
    http://www.quirksmode.org/js/events_advanced.html

    In my opinion you should not use JavaScript frameworks until you learn the JavaScript language. Frameworks are not shortcuts in programming branch!
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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