The database uses the UTF-8, the existing system uses the GB2312,
Use <script>echo_script (URL);</script>
Copy Code code as follows:
<script>
function Echo_script (URL) {
var useragent = Navigator.userAgent.toLowerCase ();
var bname = ';
var b = [' IE ', ' msie ', ' Firefox ', ' Chrome ', ' opera ', ' Safari ', ' Maxthon ', ' Mozilla ', ' WebKit '];
For (i in B) {
if (Useragent.indexof (B[i]) >-1) {
Bname = B[i];
Break
}
}
if (!bname) bname= ' other ';
var IE8 = Useragent.indexof (' msie 8 ') >-1? ' IE8 ': false;
var IE7 = Useragent.indexof (' MSIE 7 ') >-1? ' IE7 ': false;
if (bname = = ' Firefox ' | | ie8)
{
var enc = "No";
}
if (IE8) {
bname = ' IE8 ';
}else if (IE7) {
bname = ' IE7 ';
}
var tmp_ie8 = IE8? ' IE8 ': ' NO_IE8 ';
document.write ("<script src=" "+url+" &encode= "+enc+" &browser= "+tmp_ie8+" &browserv= "+bname+" ' > <\/script> ");
}
</script>
Hey, this method, resulting in a different browser garbled constantly, suffering me.
There's a simpler way.
<script type= "Text/javascript" charset= "Utf-8" src= "xx.com/xx.php" ></script>
Garbled no longer appear!