
- 帖子
- 3
- 主題
- 1
- 精華
- 0
- 積分
- 2
- 威望
- 2
- 金錢
- 0
|
autocomplete 中文顯示問題
英文,數字,英文開頭+中文,都沒有問題,但是中文的時候就有問題,沒有反映,
我用的是php+mysql。
前端網頁:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5"/>
<title>autocomplete demo</title>
</head>
<body>
<label for="t1">請輸入姓名:</label>
<input type="text" name="t1" id="t2" value="請輸入" /><br><br>
<label for="t1">請輸入姓名:</label>
<input type="text" name="t3" id="t4" value="請輸入" />
<link rel="stylesheet" type="text/css" href="js/jquery.autocomplete.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.autocomplete.pack.js"></script>
<script type="text/javascript" charset= "big5">
$("#t2").autocomplete('autocomplete.php');
$("#t4").autocomplete('autocomplete2.php');
</script>
</body>
</html>
連去db:
<?php
include("db.func");
$sql_thrName = "select cname from thr";
$rows_thrName = GetRows("teacherdata", "$sql_thrName");
$num_thrName = mysql_num_rows($rows_thrName);
while (List($cname)= mysql_fetch_row($rows_thrName))
{
$data[]=$cname;
}
if (!$q) return;
foreach ($data as $value) {
if (strpos($value, $q) !== false) {
echo mb_convert_encoding($value,'utf-8','big5')."\n";
}
}
?>
請高手幫下忙,想左幾日的,都行吾到。 |
|