You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/js/browser.js

170 lines
7.3 KiB
JavaScript

2 years ago
/*var s = "";
s += "网页可见区域宽:" + document.body.clientWidth;
s += "<br>网页可见区域高:"+ document.body.clientHeight;
s += "<br>网页可见区域宽:"+ document.body.offsetWidth +" (包括边线和滚动条)";
s += "<br>网页可见区域高:"+ document.body.offsetHeight +" (包括边线)";
s += "<br>网页正文全文宽:"+ document.body.scrollWidth;
s += "<br>网页正文部分上:"+ window.screenTop;
s += "<br>网页正文部分左:"+ window.screenLeft;
s += "<br>屏幕分辨率的高:"+ window.screen.height;
s += "<br>屏幕分辨率的宽:"+ window.screen.width;
s += "<br>屏幕可用工作区高度:"+ window.screen.availHeight;
s += "<br>屏幕可用工作区宽度:"+ window.screen.availWidth;
s += "<br>你的屏幕设置是 "+ window.screen.colorDepth +" 位彩色";
s += "<br>你的屏幕设置 "+ window.screen.deviceXDPI +" 像素/英寸";
s += "<br>网页真实宽:" + document.documentElement.scrollWidth;
s += "<br>网页真实高:"+ document.documentElement.scrollHeight;
document.write(s);*/
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)
Sys.ie = ua.match(/msie ([\d.]+)/)[1]
else if (document.getBoxObjectFor)
Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
else if (window.MessageEvent && !document.getBoxObjectFor)
Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
else if (window.opera)
Sys.opera = ua.match(/opera.([\d.]+)/)[1]
else if (window.openDatabase)
Sys.safari = ua.match(/version\/([\d.]+)/)[1];
////以下进行测试
//if(Sys.ie) document.write('IE: '+Sys.ie);
//if(Sys.firefox) document.write('Firefox: '+Sys.firefox);
//if(Sys.chrome) document.write('Chrome: '+Sys.chrome);
//if(Sys.opera) document.write('Opera: '+Sys.opera);
//if(Sys.safari) document.write('Safari: '+Sys.safari);
var webWidth;
var webHeight;
var gridObj;
var containerObj;
var browser=navigator.appName;
var b_version=navigator.appVersion;
var version=b_version.split(";");
var trim_Version=version[1].replace(/[ ]/g,"");
//针对列表类型页面
function resizeGrid(gridName,dvContainer,gridContainer,reSizeNum){
var webWidth=parseInt(document.documentElement.scrollWidth);
var webHeight=parseInt(document.documentElement.scrollHeight);
if(Sys.ie){
if("undefined" != typeof document.getElementById(gridName)){
//1252
//716 510
var setVal = 0;
if(webHeight > 800){
if(reSizeNum != null){
setVal = parseInt(webHeight - reSizeNum);
document.getElementById(gridName).style.height = setVal;//75%
}else{
setVal = parseInt(webHeight * 0.75);
document.getElementById(gridName).style.height = setVal;//75%
}
}else{
if(reSizeNum != null){
setVal = parseInt(webHeight - reSizeNum);
document.getElementById(gridName).style.height = setVal;//75%
}else{
setVal = parseInt(webHeight * 0.65);
document.getElementById(gridName).style.height = setVal//65%
}
}
// containerObj = document.getElementById(dvContainer);
//
// var tempHeight = document.getElementById(gridName).style.height;
// if("undefined" != typeof containerObj){
// containerObj.attachEvent("onresize",function(){
// setTimeout(function(){
// var webHeight=parseInt(document.documentElement.scrollHeight);
// var tempVal = document.getElementById(gridName).style.height.substring(0,document.getElementById(gridName).style.height.indexOf("p"));
//
// //alert(setVal+"###"+tempVal+"###"+webHeight);
// if(setVal != tempVal && setVal != 0 || ((setVal == tempVal) && webHeight != tempVal)){
// if(webHeight > 800){
// if(reSizeNum != null){
//
// document.getElementById(gridName).style.height = parseInt(webHeight - reSizeNum);//75%
// }else{
// document.getElementById(gridName).style.height = parseInt(webHeight * 0.75);//75%
// }
// }else{
// if(reSizeNum != null){
// document.getElementById(gridName).style.height = parseInt(webHeight - reSizeNum);//75%
// }else{
// document.getElementById(gridName).style.height = parseInt(webHeight * 0.65);//65%
// }
// }
// }
// },500);
// });
// }
if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE6.0"){
document.getElementById(gridContainer).className = "gird-ie6";
}
else{
document.getElementById(gridContainer).className = "gird-ie7";
}
// if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE7.0")
// {
// alert("IE 7.0");
// }
// else
// {
// alert("IE 6.0");
// }
// else if(browser=="Microsoft Internet Explorer" && trim_Version=="MSIE8.0")
// {
// alert("IE 8.0");
// }
}
}else if(Sys.chrome){
document.getElementById(gridContainer).className = "gird-ie7";
}
}
//针对info类型页面
function resizeDiv(gridName, dvContainer, gridContainer, reSizeNum) {
var webWidth = parseInt(document.documentElement.scrollWidth);
var webHeight = parseInt(document.documentElement.scrollHeight);
if (Sys.ie) {
if ("undefined" != typeof document.getElementById(gridName)) {
//1252
//716 510
var setVal = 0;
if (webHeight > 800) {
if (reSizeNum != null) {
setVal = parseInt(webHeight - reSizeNum);
document.getElementById(gridName).style.height = setVal; //75%
} else {
setVal = parseInt(webHeight * 0.75);
document.getElementById(gridName).style.height = setVal; //75%
}
} else {
if (reSizeNum != null) {
setVal = parseInt(webHeight - reSizeNum);
document.getElementById(gridName).style.height = setVal; //75%
} else {
setVal = parseInt(webHeight * 0.65);
document.getElementById(gridName).style.height = setVal//65%
}
}
if (browser == "Microsoft Internet Explorer" && trim_Version == "MSIE6.0") {
document.getElementById(gridContainer).className = "gird-ie6";
}
else {
document.getElementById(gridContainer).className = "gird-ie7";
}
}
} else if (Sys.chrome) {
document.getElementById(gridContainer).className = "gird-ie7";
}
}