Guest User

Untitled

a guest
Apr 26th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. <!--
  2. Document : jquery
  3. Created on : May 15, 2008, 9:13:50 AM
  4. Author : Nikesh Hajari
  5. -->
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  7. <html>
  8. <head>
  9. <title>JQuery Test</title>
  10. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  11. <script type="text/javascript" src="js/bsn.AutoSuggest_2.1.3_comp.js"></script>
  12. <link rel="stylesheet" href="css/autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" />
  13. <script type="text/javascript " src="jquery-latest.pack.js"></script>
  14.  
  15. <script type="text/javascript" src="jquery.highlightFade.js"></script>
  16. <script type="text/javascript">
  17. function addFormField() {
  18. var id = document.getElementById("id").value;
  19. $("#divTxt").append("<p id='item" + id + "'><label for='item" + id + "'>Item Name: " + " <input type='text' size='20' name='item" + id + "' id='item" + id + "'><id='qty" + id + "'><label for='qty" + id + "'> Qty: " + " <input type='text' size='3' name='qty[]' id='qty" + id + "'> <a href='#' onClick='removeFormField(\"#item" + id + "\"); removeQtyField(\"#qty" + id + "\"); return false;'>Remove Item</a></p>");
  20.  
  21. $('#item' + id).highlightFade({
  22. speed:1000
  23. });
  24.  
  25. id = (id - 1) + 2;
  26. document.getElementById("id").value = id;
  27.  
  28. item(id-1);
  29.  
  30. }
  31.  
  32. function removeFormField(id) {
  33. $(id).remove();
  34. }
  35.  
  36. function removeQtyField(id) {
  37. $(id).remove();
  38.  
  39. }
  40.  
  41.  
  42. </script>
  43. </head>
  44. <body>
  45. <p><a href="#" onClick="addFormField(); return false;">Add New Item</a></p>
  46. <form action="listitems.php" method="post" id="form1">
  47. <input type="hidden" id="id" value="1">
  48.  
  49. <div id="divTxt"></div>
  50. <p><input type="submit" value="Submit" name="submit">
  51. <input type="reset" value="Reset" name="reset"></p>
  52. </form>
  53.  
  54. <script type="text/javascript">
  55.  
  56. function item($id)
  57. {
  58. // var items_xml = new Array();
  59. //as_xml = new Array();
  60.  
  61. // var x=document.getElementsByTagName("label");
  62.  
  63.  
  64. // for(var i = 0; i < x.length/2; i++)
  65. {
  66. items_xml = {
  67. script:function (item) { return "itemsearch.php?name="+document.getElementById('item'+id).value ; },
  68. varname:"item",
  69. minchars:1,
  70. timeout:25000000,
  71. cache:false
  72. };
  73.  
  74. //alert(items_xml[i]);
  75.  
  76. alert($id);
  77. var a= new bsn.AutoSuggest('item'+id, items_xml);
  78. }
  79. }
  80.  
  81. </script>
  82.  
  83. </body>
  84. </html>
Add Comment
Please, Sign In to add comment