Javascript功能无法正常工作/在Facebook上基于iFrame的应用程序中出错!

时间:2011-04-04 13:09:34

标签: php javascript facebook fbml fbjs

我在Facebook上有一个基于iFrame的应用程序,可以实现其应有的功能。它以PHP为基础。但是,只要我放了一些Javascript函数,它就会停止工作!

我最初尝试做的是查看我是否有用户授权。如果我没有,我将用户发送到facebook的授权页面。这是代码:

<script>
    function submitMappingForm() //for mapping 
    { 
        // declare a new FBJS AJAX object
        //var ajax = new Ajax(); 
        //ajax.responseType = Ajax.FBML;

        // define a callback to handle the response from the server
        //ajax.ondone = function(data) 
        //{ 
            //document.getElementById('stat').setInnerFBML(data);
        //}

        // let the user know we're sending the data 
        //document.getElementById('stat').setInnerXHTML('Submitting your information, please wait...');

        // collect field values
        var queryParams = { 'uname' : document.getElementById('uname').getValue(), 'upass' : document.getElementById('upass').getValue(), 'user_id' : document.getElementById('userID').getValue() };
        ajax.post('http://abcd.com/efg.php', queryParams);
        return true;
    }
</script>Welcome!<script> top.location.href='http://www.facebook.com/dialog/oauth?client_id=123456789&redirect_uri=http%3A%2F%2Fapps.facebook.com%2Fsomeapp%2F'</script>

但是,我在firefox中遇到这个脚本的错误:

Error: document.getElementById("uname").getValue is not a function
Source File: <some page>
Line: 19

有谁可以让我知道我在这里做错了什么?

感谢。

- 阿赫桑

1 个答案:

答案 0 :(得分:5)

您的第一个结束脚本标记拼写错误。 </scrpt>