1/** 2 * JavaScript/Ajax Samples 3 * @module jquery_ui_dialog 4 */ 5var jquery_ui_dialog = { 6 7 errmes: undefined, 8 9 onload: function() { 10 $('#formContact').bind('submit', function() { 11 jquery_ui_dialog.checkdata(); 12 return jquery_ui_dialog.makeDialog(); 13 }); 14 $(':input').bind('blur', function() { 15 if ($(this).val().length > 0) $(this).removeClass('error'); 16 }); 17 }, 18 19 checkdata: function() { 20 jquery_ui_dialog.errmes = ''; 21 $(':input').removeClass('error'); 22 23 24 25 26 if (!$('#name').val().length > 0) { 27 jquery_ui_dialog.errmes += 'è«è¼¸å ¥å§åã<br />'; 28 $('#name').addClass('error'); 29 } 30 if (!$('#phone').val().length > 0) { 31 jquery_ui_dialog.errmes += 'è«è¼¸å ¥é£çµ¡é»è©±ã<br />'; 32 $('#phone').addClass('error'); 33 } 34 if (!$('#email').val().length > 0) { 35 jquery_ui_dialog.errmes += 'è«è¼¸å ¥emailã<br />'; 36 $('#email').addClass('error'); 37 } else { 38 if($('#email').val().indexOf('@')<0) { 39 jquery_ui_dialog.errmes += 'è«è¼¸å ¥æ£ç¢ºçé»åéµç®±å°å!<br />'; 40 $('#email').addClass('error'); 41 } 42 } 43 44 if (!$('#workdate').val().length > 0) { 45 jquery_ui_dialog.errmes += 'è«è¼¸å ¥æ½å·¥æ¥æ<br>'; 46 $('#workdate').addClass('error'); 47 } 48 if (!$('#worktime').val().length > 0) { 49 jquery_ui_dialog.errmes += 'è«è¼¸å ¥æ½å·¥æé<br>'; 50 $('#worktime').addClass('error'); 51 } 52 if (!$('#address').val().length > 0) { 53 jquery_ui_dialog.errmes += 'è«è¼¸å ¥å°å<br>'; 54 $('#address').addClass('error'); 55 } 56 57 58 }, 59 60 makeDialog: function() { 61 62 if (!jquery_ui_dialog.errmes) return true; 63 64 $('<div/>') 65 .append($('<p/>') 66 .append(jquery_ui_dialog.errmes) 67 ) 68 .dialog({ 69 bgiframe: true, 70 modal: true, 71 title: 'è«è¼¸å ¥å¿ å¡«é ç®', 72 close: function() { 73 $(this).remove(); 74 } 75 }) 76 .appendTo('document.body'); 77 78 return false; 79 } 80 81} 82 83$(function() { jquery_ui_dialog.onload(); });
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.