Mitko_jos

IA_lab7

Dec 11th, 2013
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 10.35 KB | None | 0 0
  1. 1va zadaca
  2.  
  3.  
  4.  
  5. <html>
  6.  
  7. <head>
  8. <meta charset=UTF-8>
  9. <title>Zadaca1</title>
  10.  
  11. <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css"/>
  12.  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  13.  <script src="/resources/demos/external/jquery.bgiframe-2.1.2.js"></script>
  14.  <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  15.  
  16.  <style>
  17.  body { font-size: 62.5%; }
  18. label, input { display:block; }
  19. input.text { margin-bottom:12px; width:95%; padding: .4em; }
  20. fieldset { padding:0; border:0; margin-top:25px; }
  21. h1 { font-size: 1.2em; margin: .6em 0; }
  22. div#users-contain { width: 350px; margin: 20px 0; }
  23. div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
  24. div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
  25. .ui-dialog .ui-state-error { padding: .3em; }
  26. .validateTips { border: 1px solid transparent; padding: 0.3em; }
  27.  
  28.  
  29.  
  30.  
  31.  </style>
  32.  
  33.  
  34.  <script type="text/javascript">
  35.  $(function() {
  36. var id = $( "#sifra" ),
  37. ime = $( "#ime" ),
  38. proizvoditel = $( "#proizvoditel" ),
  39. allFields = $( [] ).add( id ).add( ime ).add( proizvoditel ),
  40. tips = $( ".validateTips" );
  41. function updateTips( t ) {
  42. tips
  43. .text( t )
  44. .addClass( "ui-state-highlight" );
  45. setTimeout(function() {
  46. tips.removeClass( "ui-state-highlight", 1500 );
  47. }, 500 );
  48. }
  49. function checkRegexp( o, regexp, n ) {
  50. if ( !( regexp.test( o.val() ) ) ) {
  51. o.addClass( "ui-state-error" );
  52. updateTips( n );
  53. return false;
  54. } else {
  55. return true;
  56. }
  57. }
  58. $( "#dialog-form" ).dialog({
  59. autoOpen: false,
  60. height: 300,
  61. width: 350,
  62. modal: true,
  63. buttons: {
  64. Додади: function() {
  65. var bValid = true;
  66. allFields.removeClass( "ui-state-error" );
  67. bValid = bValid && checkRegexp( id, /^([0-9])+$/i,"Шифрата треба да биде составена единствено од броеви." );
  68. if ( bValid ) {
  69. $( "#users tbody" ).append( "<tr>" +
  70. "<td>" + id.val() + "</td>" +
  71. "<td>" + ime.val() + "</td>" +
  72. "<td>" + proizvoditel.val() + "</td>" +
  73. "</tr>" );
  74. $( this ).dialog( "close" );
  75. }
  76. },
  77. "Откажи": function() {
  78. $( this ).dialog( "close" );
  79. }
  80. },
  81. close: function() {
  82. allFields.val( "" ).removeClass( "ui-state-error" );
  83. }
  84. });
  85. $( "#create-user" )
  86. .button()
  87. .click(function() {
  88. $( "#dialog-form" ).dialog( "open" );
  89. });
  90. });
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  </script>
  98.  
  99.  
  100.  
  101.  
  102.  
  103. </head>
  104.  
  105.  
  106. <div id="dialog-form" title="Create new user">
  107. <p class="validateTips">Сите полиња се задолжителни.</p>
  108. <form>
  109. <fieldset>
  110. <label for="sifra">Шифра</label>
  111. <input type="text" name="sifra" id="sifra" class="text ui-widget-content ui-corner-all" />
  112. <label for="ime">Име</label>
  113. <input type="text" name="ime" id="ime" value="" class="text ui-widget-content ui-corner-all" />
  114. <label for="proizvoditel">Производител</label>
  115. <input type="text" name="proizvoditel" id="proizvoditel" value="" class="text ui-widget-content ui-corner-all" />
  116. </fieldset>
  117. </form>
  118. </div>
  119. <div id="users-contain" class="ui-widget">
  120. <h1>Постоечки ставки:</h1>
  121. <table id="users" class="ui-widget ui-widget-content">
  122. <thead>
  123. <tr class="ui-widget-header ">
  124. <th>Шифра</th>
  125. <th>Име</th>
  126. <th>Производител</th>
  127. </tr>
  128. </thead>
  129. <tbody>
  130. <tr>
  131. <td>12331</td>
  132. <td>име1</td>
  133. <td>производител1</td>
  134. </tr>
  135. </tbody>
  136. </table>
  137. </div>
  138. <button id="create-user">Додади нова ставка</button>
  139.  
  140.  
  141.  
  142.  
  143.  
  144. </html>
  145.  
  146. 2ra zadaca
  147.  
  148.  
  149.  
  150. <html>
  151.  
  152. <head>
  153. <meta charset=UTF-8>
  154. <title>Zadaca2</title>
  155.  
  156. <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css"/>
  157.  <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
  158.  <script src="/resources/demos/external/jquery.bgiframe-2.1.2.js"></script>
  159.  <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
  160.  
  161.  <style>
  162.  body { font-size: 62.5%; }
  163. label, input { display:block; }
  164. input.text { margin-bottom:12px; width:95%; padding: .4em; }
  165. fieldset { padding:0; border:0; margin-top:25px; }
  166. h1 { font-size: 1.2em; margin: .6em 0; }
  167. div#users-contain { width: 350px; margin: 20px 0; }
  168. div#users-contain table { margin: 1em 0; border-collapse: collapse; width: 100%; }
  169. div#users-contain table td, div#users-contain table th { border: 1px solid #eee; padding: .6em 10px; text-align: left; }
  170. .ui-dialog .ui-state-error { padding: .3em; }
  171. .validateTips { border: 1px solid transparent; padding: 0.3em; }
  172.  
  173.  
  174.  
  175.  
  176.  </style>
  177.  
  178.  
  179.  <script type="text/javascript">
  180.  $(function() {
  181.  
  182. var id = $( "#sifra" ),
  183. ime = $( "#ime" ),
  184. proizvoditel = $( "#proizvoditel" ),
  185. datum = $( "#datum" ),
  186.  
  187. allFields = $( [] ).add( id ).add( ime ).add( proizvoditel ).add(datum),
  188. tips = $( ".validateTips" );
  189. function updateTips( t ) {
  190. tips
  191. .text( t )
  192. .addClass( "ui-state-highlight" );
  193. setTimeout(function() {
  194. tips.removeClass( "ui-state-highlight", 1500 );
  195. }, 500 );
  196. }
  197. function checkRegexp( o, regexp, n ) {
  198. if ( !( regexp.test( o.val() ) ) ) {
  199. o.addClass( "ui-state-error" );
  200. updateTips( n );
  201. return false;
  202. } else {
  203. return true;
  204. }
  205. }
  206. $( "#dialog-form" ).dialog({
  207. autoOpen: false,
  208. height: 300,
  209. width: 350,
  210. modal: true,
  211. buttons: {
  212. Додади: function() {
  213. var bValid = true;
  214. allFields.removeClass( "ui-state-error" );
  215. bValid = bValid && checkRegexp( id, /^([0-9])+$/i,"Шифрата треба да биде составена единствено од броеви." );
  216. if ( bValid ) {
  217. $( "#users tbody" ).append( "<tr>" +
  218. "<td>" + id.val() + "</td>" +
  219. "<td>" + ime.val() + "</td>" +
  220. "<td>" + proizvoditel.val() + "</td>" +
  221. "<td>" + datum.val() + "</td>" +"</tr>" );
  222. $( this ).dialog( "close" );
  223. }
  224. },
  225. "Откажи": function() {
  226. $( this ).dialog( "close" );
  227. }
  228. },
  229. close: function() {
  230. allFields.val( "" ).removeClass( "ui-state-error" );
  231. }
  232. });
  233. $( "#create-user" )
  234. .button()
  235. .click(function() {
  236. $( "#dialog-form" ).dialog( "open" );
  237. });
  238. });
  239.  
  240. $(function() {
  241.     $( "#datum" ).datepicker();
  242.   });
  243.  
  244.  </script>
  245.  
  246.  
  247.  
  248. </head>
  249.  
  250.  
  251. <div id="dialog-form" title="Create new user">
  252. <p class="validateTips">Сите полиња се задолжителни.</p>
  253. <form>
  254. <fieldset>
  255. <label for="sifra">Шифра</label>
  256. <input type="text" name="sifra" id="sifra" class="text ui-widget-content ui-corner-all" />
  257. <label for="ime">Име</label>
  258. <input type="text" name="ime" id="ime" value="" class="text ui-widget-content ui-corner-all" />
  259. <label for="proizvoditel">Производител</label>
  260. <input type="text" name="proizvoditel" id="proizvoditel" value="" class="text ui-widget-content ui-corner-all" />
  261. <label for="datum">Датум</label>
  262. <input type="text" name="datum" id="datum"  class="text ui-widget-content ui-corner-all" />
  263.  
  264. </fieldset>
  265. </form>
  266. </div>
  267. <div id="users-contain" class="ui-widget">
  268. <h1>Постоечки ставки:</h1>
  269. <table id="users" class="ui-widget ui-widget-content">
  270. <thead>
  271. <tr class="ui-widget-header ">
  272. <th>Шифра</th>
  273. <th>Име</th>
  274. <th>Производител</th>
  275.  
  276. <th>Датум</th>
  277. </tr>
  278. </thead>
  279. <tbody>
  280. <tr>
  281. <td>12331</td>
  282. <td>име1</td>
  283. <td>производител1</td>
  284. <td>Датум</td>
  285. </tr>
  286. </tbody>
  287. </table>
  288. </div>
  289. <button id="create-user">Додади нова ставка</button>
  290.  
  291. </html>
  292.  
  293. 4ta zadaca
  294.  
  295.  
  296.  
  297.  
  298. <html>
  299.     <head>
  300.         <meta charset="utf-8" />
  301.         <title>Вежба 3 - sortables</title>
  302.         <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.1/themes/base/jquery-ui.css" />
  303.         <script src="http://code.jquery.com/jquery-1.8.2.js"></script>
  304.         <script src="http://code.jquery.com/ui/1.9.1/jquery-ui.js"></script>
  305.         <style>
  306.                         #sortable1 {
  307.                                 margin: 10px;
  308.                                 width: 73px;
  309.                                 height: 73px;
  310.                                 border: 1px solid black;
  311.                                 padding: 1px;
  312.                         }
  313.                         #sortable2{
  314.                                 margin: 10px;
  315.                                 width:509px;
  316.                                 height: 73px;
  317.                                 border: 1px solid black;
  318.                                 padding: 1px;
  319.                                 position:relative;
  320.                         }
  321.                         #sortable2 li {
  322.                                 float:left;
  323.                         }
  324.                         .ui-state-default {
  325.                                 width: 70px;
  326.                                 height: 70px;
  327.                                 list-style-type: none;
  328.                                 position: absolute;
  329.                                 cursor:pointer;
  330.                         }
  331.                 </style>
  332.                 <script>
  333.                     $(function() {
  334.                         $("#sortable1, #sortable2").sortable({
  335.                             connectWith : ".connectedSortable"
  336.                         }).disableSelection();
  337.                                
  338.                         $("#sortable1, #sortable2").sortable().bind('sortstop', function() {
  339.                             $("#sortable1 li").css('position', 'absolute');
  340.                             $("#sortable2 li").css('position', 'relative');
  341.                         });
  342.                     });
  343.                 </script>
  344.         </head>
  345.         <body>
  346.                 <ul id="sortable1" class="connectedSortable">
  347.                         <li class="ui-state-default">
  348.                                 Card 1
  349.                         </li>
  350.                         <li class="ui-state-default">
  351.                                 Card 2
  352.                         </li>
  353.                         <li class="ui-state-default">
  354.                                 Card 3
  355.                         </li>
  356.                         <li class="ui-state-default">
  357.                                 Card 4
  358.                         </li>
  359.                         <li class="ui-state-default">
  360.                                 Card 5
  361.                         </li>
  362.                         <li class="ui-state-default">
  363.                                 Card 6
  364.                         </li>
  365.                         <li class="ui-state-default">
  366.                                 Card 7
  367.                         </li>
  368.                 </ul>
  369.                 <ul id="sortable2" class="connectedSortable">
  370.                
  371.                 </ul>
  372.         </body>
  373. </html>
Advertisement
Add Comment
Please, Sign In to add comment