在Internet Explorer中没有使用希腊字符获取数据值 [英] Not getting data values with greek characters in Internet explorer

查看:79
本文介绍了在Internet Explorer中没有使用希腊字符获取数据值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

搜索无法在IE上运行,但在Chrome,Safari,Opera,Firefox上运行良好。



它在IE 10上搜索数据库英文字符时效果很好,但在搜索数据库查找希腊字符时没有显示为文本。这只发生在IE上。

< script type =text / javascriptsrc =http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min .js>< / script>

< script type =text / javascriptsrc =js / textinputs_jquery.js>< / script>

< script type =text / javascriptsrc =js / textinputs_jquery_src.js>< / script>

< script>

$(文件).ready(function(){



$(#comp_text)。live(''input paste'',function(){

var str = document.getElementById(comp_text);

if(str.value.length< 3){

返回false;

}

var twidth = str.offsetWidth;

$(''#txtHint'')。width(twidth);

$(''#txtHint'')。load(''gethint.php?q =''+ str.value);

});

$ (。add)。submit(function(){

if($(''#company'')。length){

return true;

} else {

alert();

返回false;

}

});

});



函数showHint(str)

{

if(str.length == 0)

{

document.getElementById(txtHint)。innerHTML =;

返回;

}

if(window.XMLHttpRequest)

{// IE7 +,Firefox,Chrome,Opera,Safari的代码

xmlhttp = new XMLHttpRequest();

}

其他

{// IE6代码,IE5

xmlhttp =新ActiveXObject(Microsoft.XMLHTTP );

}

xmlhttp。 önreadystatechange= function()

{

if(xmlhttp.readyState == 4&& xmlhttp.status == 200)

{

document.getElementById(txtHint)。innerHTML = xmlhttp.responseText;

}

}

xmlhttp .open(GET,gethint.php?q =+ str,true);

xmlhttp.send();

}





function set_val(str,company){

document.getElementById(''comp_text'')。value = str;

document.getElementById(''txtHint'')。innerHTML =;

document.getElementById(customer_place)。innerHTML =''< input type =隐藏的id =公司value =''+公司+''>'';

}

函数cust_control(){



if(document.getElementByName(''company'')){

alert();

返回false;

}否则

返回true;

}



< / s cript>

< form method = \post \name = \addn\class = \add \action = \do_insert.php \ >

< input type =textid =comp_textönkeyup=showHint(this.value)name =companysize =20style =text-align : 中央; font-size:13px;/>

< div id =txtHint>< / div>

< div id =customer_place> ;< / div>

< / form>











和gethint.php ...





 $ q = $ _ GET [  q]; 
$ response = ' ';

$ query = SELECT uid,公司FROM用户公司喜欢'。$ q。 %'和userid ='$ userid'按公司排序;
mysql_query( 设置字符集'utf8');
$ result = mysql_query($ query);

if (mysql_num_rows($ result)> 0){
$ response。= ' <表>';
while ($ row = mysql_fetch_array($ result)){
$ response。= ' < tr><tdönclick=set_val(\''。$ row [' company']。' \',\\ \\''。$ row [' uid']。' ' >。$行[ '公司'] '< / TD>< / TR>';
}
$ response。='< / table>';
echo $ response;
} else {
}

解决方案

(document).ready(function(){



(#comp_text)。live(''input paste'',function(){

var str = document.getElementById(comp_text);

if(str.value.length< 3){

返回false;

}

var twidth = str.offsetWidth;


(''#txtHint'')。width(twidth);

Search is not working on IE, but works great on Chrome, Safari, Opera, Firefox.

it works great when it searches into database english characters on IE 10 but nothing shows as text when it searches into database to find greek characters. This happens only with IE.
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="js/textinputs_jquery.js"></script>
<script type="text/javascript" src="js/textinputs_jquery_src.js"></script>
<script>
$(document).ready(function(){

$("#comp_text").live(''input paste'',function(){
var str=document.getElementById("comp_text");
if (str.value.length <3){
return false;
}
var twidth=str.offsetWidth;
$(''#txtHint'').width(twidth);
$(''#txtHint'').load(''gethint.php?q=''+str.value);
});
$(".add").submit( function(){
if($(''#company'').length){
return true;
}else{
alert("");
return false;
}
});
});

function showHint(str)
{
if (str.length==0)
{
document.getElementById("txtHint").innerHTML="";
return;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp. önreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","gethint.php?q="+str,true);
xmlhttp.send();
}


function set_val(str, company){
document.getElementById(''comp_text'').value= str;
document.getElementById(''txtHint'').innerHTML="";
document.getElementById("customer_place").innerHTML=''<input type="hidden" id="company" value="''+company+''">'';
}
function cust_control(){

if (document.getElementByName(''company'')){
alert ("");
return false;
}else
return true;
}

</script>
<form method=\"post\" name=\"addn\" class=\"add\" action=\"do_insert.php\">
<input type="text" id="comp_text" önkeyup="showHint(this.value)" name="company" size="20" style="text-align: center; font-size: 13px;"/>
<div id="txtHint"></div>
<div id="customer_place"></div>
</form>





and gethint.php ...


$q=$_GET["q"];
$response='';

$query="SELECT uid, company FROM users where company like '".$q."%' and userid='$userid' order by company";
mysql_query("set character set 'utf8'");
$result=mysql_query($query);

if (mysql_num_rows($result) > 0) {
$response.='<table>';
    while ($row=mysql_fetch_array($result)){
$response.='<tr><td önclick="set_val(\''.$row['company'].'\', \''.$row['uid'].'')">'.$row['company'].'</td></tr>';
    }
$response.='</table>';  
echo $response;
}else{
}

解决方案

(document).ready(function(){


("#comp_text").live(''input paste'',function(){
var str=document.getElementById("comp_text");
if (str.value.length <3){
return false;
}
var twidth=str.offsetWidth;


(''#txtHint'').width(twidth);


这篇关于在Internet Explorer中没有使用希腊字符获取数据值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆