我如何改變價值ID,如果我鍵入輸入文本不匹配? 下面的代碼:如何改變value id如果我鍵入輸入文本不匹配?
<script src="jquery-1.4.js"></script>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jquery.autocomplete.js"></script>
<link rel="stylesheet" type="text/css" href="jquery.autocomplete.css" />
<script>
$(document).ready(function()
{
$('[id^="participant"]').keyup(function()
{
var txt = $(this).val();
$.ajax({
type: "POST",
url: "blue.php",
data: "nameparticipant=" + txt,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(data)
{
$(this).next().val(data.d);
},
failure: failerEvent
});
});
});
</script>
這裏是PHP代碼:
<?php
include"connection.php";
$nameparticipant=$_POST["nameparticipant"]);
$res = mysql_query("select * from tabel where upper(name) like '$nameparticipant%'");
$t=mysql_fetch_array($res);
echo "$t[id]";
?>
這裏的HTML正文:
<input type="text" id="participant1" name="name[1][]" value="Andi"/>
<input type="text" id="idparticipant1" name="idparticipant[1][]" value="1001"/>
<input type="text" id="participant2" name="name[2][]" value="Smith"/>
<input type="text" id="idparticipant2" name="idparticipant[2][]" value="1005" />
我能做些什麼?請幫我:(
請幫助我:( – 2012-01-13 07:49:58
你想做什麼? – 2012-02-23 05:35:34
如果我鍵入輸入文本不匹配是什麼意思? – 2012-02-23 05:41:52