var $c = {"query":{"_j":["set_form_style"],"id":["inquiry"]},"action":"index","config":{"encodingOfHTML":"utf8","style":{"input":{"onfocus":{"color":"#000","background":"#CC0"},"default":{"color":"#000","background":"#FFC"},"invalid":{"color":"#FFF","background":"#F00"}},"errsign":{"default":{"color":"#000","background":"#F0F0F0"},"invalid":{"color":"#F00","background":"#FCC"}}},"mail_settings":{"client":"sendmail","path":"/usr/sbin/sendmail"}},"stylesheet":null,"javascript":"set_form_style","image":null,"module":null}; Event.observe(window, 'load', function(){ $A($('inquiry').elements).each(function(e){ if(!e.type.match(/(button|submit|reset|checkbox|radio)/i)){ // オンフォーカス e.style.color = '#000'; e.style.background = '#FFC'; Event.observe(e, 'focus', function(){ if(!Element.hasClassName(this, 'invalid')) { this.style.color = '#000'; this.style.background = '#CC0'; } }); Event.observe(e, 'blur', function(){ if(!Element.hasClassName(this, 'invalid')) { this.style.color = '#000'; this.style.background = '#FFC'; } }); } }); // errsignクラスにスタイルを適用 $$('*').each(function(element){ if(element.className.match(/( |^)errsign_/)) { element.style.color = '#000'; element.style.background = '#F0F0F0'; } }); });