2007/12/13 22:24
훌륭한 자바스크립트 라이브러리인 Prototype.js 잘 사용하고 계신가요? 1. document.getElementById('foo') 대신 $('foo') 를 사용 할 것 2. var woot = $('bar').value 대신 var woot = $F('bar') 를 사용 할 것 3. $('footer').style.height = '100px'; $('footer').style.background = '#ffc'; 대신 $('footer').setStyle({ height: '100px', background: '#ffc' }) 를 사용 할 것 4. $('coolestWidgetEver').innerHTML = 'some nifty content' 대신 $('coolestWidgetEver').update('some nifty content') 를 사용 할 것 5. new Ajax.Request('ninja.php?weapon1=foo&weapon2=bar') 대신 new Ajax.Request('ninja.php', { parameters: { weapon1: 'foo', weapon2: 'bar' } }) 를 사용 할 것 6. new Ajax.Request('blah.php', { method: 'POST', asynchronous: true, contentType: 'application/x-www-form-urlencoded', encoding: 'UTF-8', }) 대신 new Ajax.Request('blah.php') 사용 할 것 7. Event.observe('myContainer', 'click', doSomeMagic) 대신 $('myContainer').observe('click', doSomeMagic) 사용 할 것 8. $$('div.hidden').each(function(el){ el.show(); }) 대신 $$('div.hidden').invoke('show') |
Trackback Address :: http://blog.phpdic.com/trackback/6


