我试图让浏览器窗口宽度的结果,并试图把数学和条件的结果变量,这是代码返回通过存储在一个变量
var MyWidth = 1900;
var MyHeight = 900;
var height = $(window).height();
var width = $(window).width();
var AutoW = function() {
if ((MyWidth/width).toFixed(2) > 0.95)
return 1;
if ((MyWidth/width).toFixed(2) < 1.05)
return 1;
else return (MyWidth/width).toFixed(2);
};
alert(AutoW);
函数运算结果的值
问题是我不知道赋给变量
什么是代码的正确方法函数的正确的语法或结构?
AutoW只是在运行时定义的函数,尝试调用alert(AutoW()),您将获得价值。现在如果你想获得这个函数的值AutoW,然后声明另一个函数,并调用它与赋值 – Kasma 2013-05-13 07:03:34