首页 > 语言 > JavaScript > 正文

js函数返回多个返回值的示例代码

2024-05-06 14:34:15
字体:
来源:转载
供稿:网友
代码如下:
var w = getClientSize().width;
var h = getClientSize().height - 97;

代码如下:
function getClientSize() {
var a = h = 0;
if (window.innerHeight) {
a = window.innerWidth;
h = window.innerHeight
} else {
if (document.documentElement && document.documentElement.clientHeight) {
a = document.documentElement.clientWidth;
h = document.documentElement.clientHeight
} else {
a = document.body.clientWidth;
h = document.body.clientHeight
}
}
return {
width: a,
height: h
};
}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选