mootools example!
mootools is the next version in the Mad4Milk.com library set. The guys took the moo.ajax, moo.fx and the prototype.lite library and re-worked it to exclude the prototype part of the library and combine all the moo libraries in one library. When you go download the scripts, you can decide which add-ons and plug-ins you would like to include.
Note: the moo.ajax library is deprecated and you will need to replace it with the mootools library.
If you looked at my moo.ajax example, you will note that there is only one difference in the implementation of the ajax library.
moo.ajax:
new ajax(’stii.php’, {postBody: ‘name=’ + name + ‘&msg=’ + mesg, update: $(’myelementid’), onComplete: myFunction});
mootools:
new ajax(’stii.php’, {postBody: ‘name=’ + name + ‘&msg=’ + mesg, update: $(’myelementid’), onComplete: myFunction}).request();
As you can see, the only difference is the request() at the end.
In the mootools example, I combined the ajax call with an effect to change the <div> element style.
There are many, many options in the mootools library. Here I have used the Fx.Style class to manipulate the <div> element height, width and opacity.
function myFunction(){
var myEffects = new fx.Styles(’myelementid’, {duration: 500, transition: fx.Transitions.linear});
myEffects.custom({
‘height’: [40, 100],
‘width’: [400, 300],
‘opacity’: [1,0.3]
});
}
In this example, the font color changes from white to red.
function myFunction(){
var myEffects = new fx.Color(’myelementid’, ‘color’, {duration: 500});
myEffects.toColor(’f00′);
}
TIP: The effect ALWAYS looks better in Firefox. Don’t believe me? Try it in IE then in Firefox or Flock and see the difference
Blogged with Flock
6 Comments to "mootools example!"
Spit it out!
ajax, javascript, moo.ajax, mootools Stii
Recent Posts
- Astalavista Wordpress!
- Lifestreaming and Twitter is making us lazy
- Days with my father
- Friday morning fail by a stripper
- Got Springleap!
- Afrigator vs Regator
- Don’t pirate music/movies! You might be forced to use Windows if you do…
- Pike > Python?
- Using Twhirl for FriendFeed
- Being anti-social SUCKS!
My Posse
- Jayx’s bloggy
- Gogo’s blog
- Go2 South Africa
- Stumble Upon
- Dave Duarte
- Wikipedia
- zlythern
- Max Kaizen
- Tresblue
- Mike Stopforth
- RafiQ
- Muti.co.za
- Employmint
- Danette’s Bloggy!
- Thinking Machine
- White African
- kiefpiet.co.za
- Skuff’s World
- Goozeberry
- Crossloop blog
- Crossloop
- Aquila Online
- Charl van Niekerk
- Derek Allard
- Code Igniter
- Carls
- Justin Hartman
- blik.co.za
- Stefano Sessa
- Uno de Waal
- Amplitude!
- bLaugh
- Tyler Reed
- Chris Rawlinson
- Stormhoek!
- 3am
- Mike Solomon
- Mobile Q and A
- Eric Edelstein
- Marc Forrest
- Imel Rautenbach
- Absolutewillie
- Vincent Maher
- Colin Daniels
- Groogle!
- Chilibean
- Paul Jacobson
- Ayelet
- Python Guru Neil
- Rails Guru Nic
- Beverley Merriman
- Miguel
- Nic Harrywhatshisname
- Chris iMod
- Geekrebel!
- Steven McD
- Belinda sweetheart!
- Henre Rossouw
- JPGeek
- Foxinni
- Adii
- Charl Norman
- Bandwidthblog
- Jason Bagley
- Simon Botes
- Auric Silverwing
- Mark Forrester
- Saul Kropman
- Fred Roed
- Sass Schultz
- Gregor Rohrig
- Catherine Lückhoff
- Toastmasters
Filed in
- Afrigator (26)
- ajax (9)
- API (2)
- Apple stuff (10)
- Blogging (25)
- browsers (5)
- Business (28)
- Code Igniter (8)
- firefox (8)
- flock (14)
- Funnies (73)
- GeekDinner! (18)
- General and sometimes Rants (49)
- Go2SA (2)
- ideas 2.0 (14)
- javascript (12)
- Kick-ass Tools (30)
- Linux (5)
- Marketing (25)
- moo.ajax (4)
- mootools (6)
- Open Source (10)
- Programming (33)
- C# (1)
- PHP (13)
- Python (9)
- Ruby (on Rails) (9)
- RSS (5)
- Semantic Web (32)
- Social Web (57)
- Software Development (15)
- South Africa (33)
- Tagging (6)
- Techie stuff (22)
- Tshirts (3)
- Tutorials (42)
- Blogging (17)
- Flocking (6)
- muti.co.za (13)
- Web 2.0 (73)
- web development (20)
Past Stuff
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
















great example
this will help beginners to get use to mootools 

nice work Stii
Stii, check this out
I saw that 1! And an awesome and complete reference it is!
Everyone interested in mootools, check this one out:
http://clientside.cnet.com/examples/mootools-primer/
what are the contents of stii.php ?
[...] I took my previous mootools example and added a validate function: function validate(form1){ if (form1) { if ($(’yourname’).value.trim() == “”) { alert(”Name field cannot be empty”); $(’yourname’).focus(); return; } else if ($(’yourmsg’).value.trim() == “”) { alert(”Message field cannot be empty”); $(’yourmsg’).focus(); return; } else { aStiiFunction(); } } else { if ($(’yourname1′).value.trim() == “”) { alert(”Name field cannot be empty”); $(’yourname1′).focus(); return; } else if ($(’yourmsg1′).value.trim() == “”) { alert(”Message field cannot be empty”); $(’yourmsg1′).focus(); return; } else { aStiiFunction1(); } } } [...]
[...] You get your graphic designer and tell him: “You. Go look at some web 2.0 sites and make our site look that way! NOW!”. Then you ask your programmer: “You. Do you know AJAX?” and he reply “No.” and you reply “You are FIRED!” and you hire an AJAX specialist. You tell him “No page must reload. All forms and navigation must go through AJAX calls!” ( After a couple of months you’ll fire him again because your SEO is not working ). You add a blog to your web site. [...]