JS Output List Implementation Code _ basics

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.