Posted By

keanu on 02/18/10


Tagged

mootools


Versions (?)

讓 jQuery 與 MooTools 並存


 / Published in: JavaScript
 

URL: http://net.tutsplus.com/tutorials/javascript-ajax/make-your-mootools-code-shorter-faster-and-stronger/

from here

  1. <!-- jquery gets the "$" method -->
  2. <script type="text/javascript" src="jquery-1.4.js" />
  3. <!-- mootools doesn't steal the "$" method; instead, document.id will be used -->
  4. <script type="text/javascript" src="mootools.js" />
  5. <!-- lets use them -->
  6. <script type="text/javascript">
  7. //with jquery, grab all links, make then red
  8. $('a').css('color','red');
  9. //with mootools, get the content div, set it's background color to pink
  10. document.id('content').setStyle('background','pink');
  11. //with mootools, get the content div, set it's background color to pink
  12. //this time, we'll give mootools the "$" method
  13. (function($) {
  14. $('content').setStyle('background','pink');
  15. })(document.id);
  16. </script>

Report this snippet  

You need to login to post a comment.