Search

4/23/2008

YAHOO.lang.merge

YAHOO.lang.merge


YAHOO.namespace('example');

YAHOO.example.set1 = { foo : "foo" };
YAHOO.example.set2 = { foo : "BAR", bar : "bar" };
YAHOO.example.set3 = { foo : "FOO", baz : "BAZ" };

YAHOO.example.doMerge = function () {
var Ye = YAHOO.example;

var merged = YAHOO.lang.merge(Ye.set1, Ye.set2, Ye.set3);

// Output the stringified version of merged
var result = YAHOO.util.Dom.get('demo_result');
result.innerHTML = YAHOO.example.stringifyObj(merged);
}

YAHOO.util.Event.on('demo_btn','click',YAHOO.example.doMerge);

沒有留言: