if(document.charset){
document.writeln('<script src="http://www.zzwcw.com/swt/bottomfloat.js" charset="GBK"></script>');
}else if(document.characterSet){
document.writeln('<script src="http://www.zzwcw.com/swt/bottomfloat.js" charset="utf-8"></script>');
}
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gbk">
</head>
<script type="text/javascript">
function getPageCharset(){
var charSet = "";
var oType = getBrowser();
switch(oType){
case "IE":
charSet = document.charset;
break;
case "FIREFOX":
charSet = document.characterSet;
break;
case "CHROME":
charSet = document.characterSet;
break;
default:
break;
}
return charSet;
}
function getBrowser(){
var oType = "";
if(navigator.userAgent.indexOf("MSIE")!=-1){
oType="IE";
}else if(navigator.userAgent.indexOf("Firefox")!=-1){
oType="FIREFOX";
}else if(navigator.userAgent.indexOf("WebKit")!=-1 ){
oType="CHROME";
}
return oType;
}
alert(getPageCharset());
</script>
<body>
</body>
</html>