Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--
- Document : jquery
- Created on : May 15, 2008, 9:13:50 AM
- Author : Nikesh Hajari
- -->
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
- <html>
- <head>
- <title>JQuery Test</title>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <script type="text/javascript" src="js/bsn.AutoSuggest_2.1.3_comp.js"></script>
- <link rel="stylesheet" href="css/autosuggest_inquisitor.css" type="text/css" media="screen" charset="utf-8" />
- <script type="text/javascript " src="jquery-latest.pack.js"></script>
- <script type="text/javascript" src="jquery.highlightFade.js"></script>
- <script type="text/javascript">
- function addFormField() {
- var id = document.getElementById("id").value;
- $("#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>");
- $('#item' + id).highlightFade({
- speed:1000
- });
- id = (id - 1) + 2;
- document.getElementById("id").value = id;
- item(id-1);
- }
- function removeFormField(id) {
- $(id).remove();
- }
- function removeQtyField(id) {
- $(id).remove();
- }
- </script>
- </head>
- <body>
- <p><a href="#" onClick="addFormField(); return false;">Add New Item</a></p>
- <form action="listitems.php" method="post" id="form1">
- <input type="hidden" id="id" value="1">
- <div id="divTxt"></div>
- <p><input type="submit" value="Submit" name="submit">
- <input type="reset" value="Reset" name="reset"></p>
- </form>
- <script type="text/javascript">
- function item($id)
- {
- // var items_xml = new Array();
- //as_xml = new Array();
- // var x=document.getElementsByTagName("label");
- // for(var i = 0; i < x.length/2; i++)
- {
- items_xml = {
- script:function (item) { return "itemsearch.php?name="+document.getElementById('item'+id).value ; },
- varname:"item",
- minchars:1,
- timeout:25000000,
- cache:false
- };
- //alert(items_xml[i]);
- alert($id);
- var a= new bsn.AutoSuggest('item'+id, items_xml);
- }
- }
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment