Javascript 函数无法正常工作/在 Facebook 上基于 iFrame 的应用程序中出现错误!
我在 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
任何人都可以让我知道我在这里做错了什么吗?
谢谢。
- 阿山
I have a iFrame based app on Facebook which does what its supposed to. Its PHP-based. However, as soon as I put some Javascript function, it stops working at all!
What I am initially trying to do is to see if I have authorization for the user. If I dont have it, I send the user to the authorization page of facebook. Here's the code:
<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>
However, I am getting an error with this script in firefox which is:
Error: document.getElementById("uname").getValue is not a function
Source File: <some page>
Line: 19
Can anyone kindly let me know what I am doing wrong here ?
Thanks.
-
ahsan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的第一个结束脚本标签拼写不正确。
Your first closing script tag is spelt incorrectly.
</scrpt>