yui code snippet

The Yahoo! User Interface Library. Simon Willison. XTech Ajax Developer’s Day
Preparatory notes for “The Yahoo! User Interface Library” at XTech
getElementsBy which is more general, taking an acceptance function that is passed each node in turn and must return true or false:

YAHOO.util.Dom.getElementsBy(function(el) {    return (/^http:\/\/www\.yahoo\.com/.test(el.getAttribute('href')));}));

YAHOO.util.Connect.asyncRequest(    'GET', '/ajaxy-goodness', {        success: function(o) {            alert(o.responseText);        },        failure: function(o) {            alert('Request failed: ' +o.statusText);        }    });

Custom Event

var myEvent = new YAHOO.util.CustomEvent(    'myEvent');myEvent.subscribe(function() {    alert('event fired');});myEvent.fire();

onavailable

YAHOO.util.Event.onAvailable(    'mydiv', function() {        alert('mydiv has become available');    });

Extra callback arguments

function msgAlert(e, msg) {    alert(msg);}YAHOO.util.Event.on(    'mydiv', 'click', msgAlert, "My div was clicked");

0 Responses to “yui code snippet”


  1. No Comments

Leave a Reply

You must login to post a comment.