ajaxjsphp
index.html
測試
zi.js
$(function(){ $(':button[name=add]').click(function(){ insertTr(); }) $('button[name=del]').click(function(){ $(this).parents('tr').remove(); })})var gradeI=1;function insertTr(){ var html=''; html+=' '; html+='單位(米)'; html+='刪除'; $('#tab').append(html); $('button[name=del]').click(function(){ $(this).parents('tr').remove(); }) gradeI++; }
sspp.js
var myS=document.getElementsByName("inputString");function lookup(inputString) { if(inputString.length == 0) { // Hide the suggestion box. $('#suggestions').hide(); } else { $.post("rpc.php", {queryString: ""+inputString+""}, function(data){ if(data.length >0) { $('#suggestions').show(); $('#autoSuggestionsList').html(data); } else { var myzd="沒有這個商品"; $('#suggestions').show(); $('#autoSuggestionsList').html(myzd); }}); } } // lookup function fill(thisValue) { $('#inputString').val(thisValue); setTimeout("$('#suggestions').hide();", 200); }