prototype.js �������(�Ż���)�ȤäƤߤ褦�Ȥ������ǥ��˥祴�˥礷����⡣
��ꤿ�������̾�Υƥ����Ȥ��Խ���ǽ�ˤ��� Ajax ����¸�äƤ������꤬��(��)�ʻ����ǡ��Ȥ������ٶ����Ƥ�������ɤ�Τ��Ƥ����Ȱʲ��Τ褦�ʴ���
var Editable = Class.create(); Editable.prototype = { initialize: function(text, url) { this.view = $(text); this.url = url; Element.show(this.view); this.editor = document.createElement('input'); this.editor.type = "text"; Element.hide(this.editor); this.view.parentNode.appendChild(this.editor); Event.observe(this.view, 'dblclick', this.showEditor.bindAsEventListener(this), false); Event.observe(this.editor, 'blur', this.editDone.bindAsEventListener(this), false); }, showEditor: function() { Position.clone(this.view, this.editor); this.editor.value = this.view.innerHTML; Element.toggle(this.view, this.editor); Field.focus(this.editor); }, editDone: function() { Element.toggle(this.view, this.editor); var parameters = encodeURIComponent(this.view.id) + "=" + encodeURIComponent(this.editor.value); new Ajax.Request(this.url, { method: 'post', asynchronous: true, parameters: parameters, onLoading: function() { this.view.innerHTML = "saving..."; }.bind(this), onSuccess: function() { this.view.innerHTML = this.editor.value; }.bind(this) }); } };�����editable.js �Ȥ�����¸���ơ��ʲ��Τ褦�˸ƤӽФ��ȥ��֥륯��å����Խ���ǽ���Խ�������ä����̤ΤȤ���å�����¸�äƤʵ�ư�ˤʤ�ޤ���
<html> <head> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <script type="text/javascript" src="prototype.js"></script> <script type="text/javascript" src="editable.js"></script> <title></title> </head> <body> <div id="editText" style="border: 1px solid #000000; width: 300px;">Hello World!</div> <script type="text/javascript"> new Editable('editText', '/path/to/save.app'); </script> </body> </html>/path/to/save.app ���ꥯ�����Ȥ�����Ȥ륢�ץꥱ�������ˤʤ�ޤ���
���ץ�¦�ˤ� <id>=<��> �äƴ������ͤ��ϤäƤ��ޤ���
prototype.js �Ȥ��ȥ����ɤ����å��ꤷ�������������������Ǥ��ʡ���