2. How is quot;YUIquot; pronounced?
Within the YUI team, we tend to pronounce
it quot;why-you-eyequot;. However, in the wider world
we more often hear it pronounced quot;yooey.quot;
There's no wrong answer here.
14. <script>
(function() {
var helloWorld = function(e) {
alert(quot;Hello World!quot;);
}
YAHOO.util.Event.addListener(quot;containerquot;, quot;clickquot;, helloWorld);
var interceptLink = function(e) {
YAHOO.util.Event.preventDefault(e);
alert(quot;You clicked on the second YUI link.quot;);
}
YAHOO.util.Event.addListener(quot;secondAquot;, quot;clickquot;, interceptLink);
})();
</script>
15. <script>
(function() {
var helloWorld = function(e) {
YAHOO.log(quot;helloWorld function firing.quot;, quot;infoquot;, quot;examplequot;);
alert(quot;Hello World!quot;);
}
YAHOO.util.Event.addListener(quot;containerquot;, quot;clickquot;, helloWorld);
var interceptLink = function(e) {
YAHOO.util.Event.preventDefault(e);
YAHOO.log(quot;You clicked on the second YUI link.quot;, quot;infoquot;, quot;examplequot;);
alert(quot;You clicked on the second YUI link.quot;);
}
YAHOO.util.Event.addListener(quot;secondAquot;, quot;clickquot;, interceptLink);
YAHOO.log(quot;When you begin interacting with the example at left, you'll see log
messages appear here.quot;, quot;infoquot;, quot;examplequot;);
})();
</script>
16. Custom events
var onSizeChange = new YAHOO.util.CustomEvent (quot;onSizeChangequot;);
function fnClick(e) {
. . .
onSizeChange.fire ({width: newWidth,
height: newHeight});
}
onSizeChange.subscribe (fnSubscriberWidth);
onSizeChange.subscribe (fnSubscriberHeight);
fnSubscriberWidth = function (type, args) {
var newWidth = args[0].width;
. . .
}
fnSubscriberHeight = function(type, args) {
var newHeight = args[0].height;
. . .
}