The bad news: JavaScript is broken.
The good news: It can be fixed with more JavaScript!
Cool, just like in Star Tre--!
Note: these are based on local visitor statistics. If your main audience is China based, you MUST support IE6 for example.
Element#addEventListener
support but uses its own proprietary Element#attachEvent
to handle eventsdowebsitesneedtolookexactlythesameineverybrowser.com
But your site does need to work in every browser
Welcome to the Head Museum. I'm Leonard Nimoy.
I am Bender. Please insert girder.
DateJS — open-source JavaScript Date Library.
money.js — JavaScript currency conversion
SWFObject — Embed Flash Files
var flashvars = false;
var params = {
menu: 'false',
flashvars: 'name1=hello&name2=world&name3=foobar'
};
var attributes = {
id: 'myDynamicContent',
name: 'myDynamicContent'
};
swfobject.embedSWF('myContent.swf', 'myContent', '300', '120', '9.0.0','expressInstall.swf', flashvars, params, attributes);
highlight.js — Syntax Higlighting
They're 60% scale replicas of me! ... Bender!
Lightbox — Overlay images on the current page.
reveal.js — An easy to use CSS 3D slideshow tool for quickly creating good looking HTML presentations.
TinyMCE — Rich Text Editor
Google Maps JS API — Maps & Streetview integration.
JavaScript DatePicker
JavaScript Data Grid & other UI Components such as a slider control, tabs, etc.
To the flying machine!
.prototype
'd way)String#strip
, Array#reverse
, Array#first
, Element#hide
, ...)$
, $$
, $F
, $A
, ...)
#message
and update its innerHTML
$('message').addClassName('read').update('I read this message!');
li
's
$$('#bmarks li').each(function(li){
Event.observe(li, 'click', function(e) {
this.style.backgroundColor = 'yellow';
}.bindAsEventListener(li));
});
Effect.SlideDown('id_of_element', { duration: 3.0 });
// properties are directly passed to `create` method
var Person = Class.create({
initialize: function(name) {
this.name = name;
},
say: function(message) {
return this.name + ': ' + message;
}
});
// when subclassing, specify the class you want to inherit from
var Pirate = Class.create(Person, {
// redefine the speak method
say: function($super, message) {
return $super(message) + ', yarr!';
}
});
var john = new Pirate('Long John');
john.say('ahoy matey');
// -> "Long John: ahoy matey, yarr!"
YAHOO
namespaceYAHOO.util.Event.on(window, 'load', function() {
var div = YAHOO.util.Dom.get('messages');
if (!div) {
return;
}
setTimeout(function() {
var anim = new YAHOO.util.Anim(div, {
height: {to: 0},
opacity: {to: 0}
}, 0.4);
anim.animate();
anim.onComplete.subscribe(function() {
div.parentNode.removeChild(div);
});
}, 2000);
});
YUI().use('node', function(Y) {
var onClick = function(e) {
var type = e.type,
currentTarget = e.currentTarget, // #demo
target = e.target; // #demo or a descendant
Y.one('#event-result').setContent('<dl>' +
'<dt>type</dt><dd>' + e.type + '</dd>' +
'<dt>target</dt><dd>' + target.get('tagName') + '</dd>' +
'<dt>currentTarget</dt><dd>' + currentTarget.get('tagName') +
'#' + currentTarget.get('id') + '</dd></dl>');
};
Y.one('#demo').on('click', onClick);
});
#message
and update its innerHTML
$('#message').addClass('read').html('I read this message!');
li
's
$('#bmarks li').on('click', function(e) {
$(this).css('backgroundColor', 'yellow');
});
$('#id_of_element').slideDown(3);
What is that?
One of those Led Zeppelins I've heard so much about?