Advertisement
Guest User

Untitled

a guest
Aug 20th, 2011
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.57 KB | None | 0 0
  1. <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.14.custom.css" rel="stylesheet" />
  2. <script src="js/jquery-1.5.1.min.js" type="text/javascript"></script>
  3. <script src="js/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
  4. <link rel="stylesheet" type="text/css" href="style.css" />
  5. <script type="text/javascript">
  6. $(document).ready(function() {
  7. //start combo select
  8. (function( $ ) {
  9. $.widget( "ui.combobox", {
  10. _create: function() {
  11.  
  12. var self = this,
  13. select = this.element.hide(),
  14. selected = select.children( ":selected" ),
  15. value = selected.val() ? selected.text() : "";
  16. var input = this.input = $( "<input>" )
  17. .insertAfter( select )
  18. .val( value )
  19. .autocomplete({
  20. delay: 0,
  21. minLength: 0,
  22. source: function( request, response ) {
  23. var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
  24. response( select.children( "option" ).map(function() {
  25. var text = $( this ).text();
  26. if ( this.value && ( !request.term || matcher.test(text) ) )
  27. return {
  28. label: text.replace(
  29. new RegExp(
  30. "(?![^&;]+;)(?!<[^<>]*)(" +
  31. $.ui.autocomplete.escapeRegex(request.term) +
  32. ")(?![^<>]*>)(?![^&;]+;)", "gi"
  33. ), "<strong>$1</strong>" ),
  34. value: text,
  35. option: this
  36. };
  37. }) );
  38. },
  39. select: function( event, ui ) {
  40. ui.item.option.selected = true;
  41. self._trigger( "selected", event, {
  42. item: ui.item.option
  43. });
  44. },
  45. change: function( event, ui ) {
  46. if ( !ui.item ) {
  47. var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ),
  48. valid = false;
  49. select.children( "option" ).each(function() {
  50. if ( $( this ).text().match( matcher ) ) {
  51. this.selected = valid = true;
  52. return false;
  53. }
  54. });
  55. if ( !valid ) {
  56. // remove invalid value, as it didn't match anything
  57. $( this ).val( "" );
  58. select.val( "" );
  59. input.data( "autocomplete" ).term = "";
  60. return false;
  61. }
  62. }
  63. }
  64. })
  65.  
  66. .addClass( "ui-widget ui-widget-content ui-corner-left ui-corner-right inputCustom" )
  67.  
  68. input.data( "autocomplete" )._renderItem = function( ul, item ) {
  69. return $( "<li></li>" )
  70. .data( "item.autocomplete", item )
  71. .append( "<a>" + item.label + "</a>" )
  72. .appendTo( ul );
  73. };
  74.  
  75.  
  76. },
  77.  
  78. destroy: function() {
  79. this.input.remove();
  80. this.button.remove();
  81. this.element.show();
  82. $.Widget.prototype.destroy.call( this );
  83. }
  84. });
  85. })( jQuery );
  86.  
  87. $(function() {
  88. $( ".combobox" ).combobox();
  89. });
  90. //end combo select
  91. $(".datePicker").datepicker({dateFormat: 'yy-mm-dd'});
  92.  
  93. $(".statusC").change(function () {
  94. var id=$(this).attr('id');
  95. var status = $(".statusC#"+id+" option:selected").val();
  96. $.ajax({
  97. type: "POST",
  98. url: "checkStatus.php",
  99. data: "routeid="+id+"&status="+status,
  100. success: function(html){
  101. //alert("Status successfully changed!");
  102. javascript:location.reload(true);
  103. }
  104. });
  105. });
  106.  
  107. $(".statusWheel").change(function () {
  108. var status = $(".statusWheel option:selected").val();
  109. window.location = "index2.php?statusQ="+status;
  110. });
  111.  
  112. $(".typeQ").change(function () {
  113. var typeQ = $(".typeQ option:selected").val();
  114. //alert(typeQ);
  115. $.ajax({
  116. type: "POST",
  117. url: "searchAuto.php",
  118. data: "typeQ="+typeQ,
  119. success: function(resultSearch){
  120. $('.search').html(resultSearch);
  121. }
  122. });
  123. });
  124.  
  125. $('.closeAlertL').click(function() {
  126. $('#alertBar').hide('slow');
  127. });
  128. var genNumber = 0;
  129. $('.addSchoolGen').click(function() {
  130. genNumber = document.getElementById("genNum").value;
  131. $.ajax({
  132. type: "GET",
  133. url: "addRouteGen.php",
  134. data: "type=school&num="+genNumber,
  135. success: function(result){
  136. $('.schoolStudentIn').append(result);
  137. $(".combobox").combobox();
  138. }
  139. });
  140.  
  141. genNumber++;
  142. });
  143.  
  144. $('.addStudentGen').click(function() {
  145. genNumber = document.getElementById("genNum").value;
  146. $.ajax({
  147. type: "GET",
  148. url: "addRouteGen.php",
  149. data: "type=student&num="+genNumber,
  150. success: function(result){
  151. $('.schoolStudentIn').append(result);
  152. $(".combobox").combobox();
  153. }
  154. });
  155.  
  156. genNumber++;
  157. });
  158.  
  159. $('.removeStop').click(function(e) {
  160. e.preventDefault();
  161. $(this).closest('tr').fadeOut(400, function () {
  162. $(this).remove();
  163. });
  164. });
  165. });
  166. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement