Guest User

script22

a guest
May 22nd, 2017
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
  4. <script type="text/javascript">
  5. $(function() {
  6. var addDiv = $('#addinput');
  7. var i = $('#addinput p').size() + 1;
  8.  
  9. $('#addNew').live('click', function() {
  10. $('<p>Lungime: <input type="text" id="p_new" size="40" name="p_new_' + i +'" value="" placeholder="Lungime '+ i +'" /></p><p>Latime: <input type="text" id="p_new" size="40" name="p_new_' + i +'" value="" placeholder="Latime '+ i +'" /></p>').appendTo(addDiv);
  11. i++;
  12. <?php $i = $_GET['i']; ?>
  13. return false;
  14. });
  15.  
  16. $('#remNew').live('click', function() {
  17. if( i > 2 ) {
  18. $(this).parents('p').remove();
  19. i--;
  20. }
  21. return false;
  22. });
  23. });
  24. </script>
  25.  
  26. </head>
  27. <body>
  28. <h2>Calculator pret</h2>
  29. <form action id="calc" method='post' action=''>
  30. <div id="addinput">
  31. <p>
  32. <p>Lungime: <input type="text" id="p_new" size="20" name="p_new" value="" placeholder="Lungime" /></p>
  33. Latime: <input type="text" id="p_new" size="20" name="p_new" value="" placeholder="Latime" /></p>
  34. <br>
  35. <a href="#" id="addNew">Adauga</a>&nbsp;&nbsp;
  36. <a href="#" id="calc">Calculeaza</a>
  37. </p>
  38. </div>
  39. </form>
  40. </body>
  41. </html>
Add Comment
Please, Sign In to add comment