首页 新闻 会员 周边

【初学者恳请指导】JS 报错 missing : after property id

0
悬赏园豆:5 [已解决问题] 解决于 2015-03-10 20:31

以下代码报错信息为:missing : after property id   

调试工具为 firebug 

初学者,恳请指导!

<script type="text/javascript">
    window.onload = {
        function addNum(){
            var num = muti(1,2);
            console.log(num);
        }
    }
    function muti(x,y)
    {
        if(muti.arguments.length==2)
        {
            if( (typeof(x)!="number" || (typeof(y)!="number"))
                return errorNum;
            else
                return (x*y);
        }
        return;
    }
</script>
Elissa.Cool的主页 Elissa.Cool | 菜鸟二级 | 园豆:205
提问于:2014-04-19 11:02
< >
分享
最佳答案
0

问题不是出现在这里。

收获园豆:5
lucika.zh | 初学一级 |园豆:62 | 2014-04-19 11:34
其他回答(1)
1

有两点:

(1)window.onload = function(){} 而不应该赋值一个对象

(2)if( (typeof(x)!="number") || (typeof(y)!="number")) 少了一个括号

我用的是谷歌浏览器

ThreeTree | 园豆:1490 (小虾三级) | 2014-04-19 12:16
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册