首页 > 语言 > JavaScript > 正文

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

2024-05-06 15:54:06
字体:
来源:转载
供稿:网友
js函数一般都是返回一个值,在本例教程中将为大家介绍下如何返回多个返回值,喜欢的朋友可以了解下

复制代码 代码如下:


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
};
}

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选