我想在我的facebook应用中使用javascript,但是我不知道如何从FBJS开始使用它。谁来帮帮我!就像这样
<div onclick="greeting();">click me</div>
<script>
function greeting(){
alert("hello world");
}
</script>发布于 2009-06-26 16:59:48
这对我来说很有效:
<script type="text/javascript">
function areyousure(description,id,opt) { var dialog = new Dialog(Dialog.DIALOG_POP).showChoice('Are you sure?','Are you sure you want to delete "' + description + '"? This action cannot be undone!','Yes','No');
dialog.onconfirm = function() {
document.setLocation("http://apps.facebook.com/myapp/delete.php?rec
ord=" + id + opt);
}
}
</script>
.
.
.
<a href="#" onclick="areyousure(arg1,arg2,arg3)" ><img src="http://mysite/images/delete.png" /></a>发布于 2009-06-26 05:24:24
快速列出你能得到的东西,以及你应该用什么来代替:
alert() -> no equivalent
new Array() -> []
new Object() -> {} "Big 2“DOM改变了,这破坏了我的很多代码”回想起来“:
innerHTML -> setInnerXHTML(), note that this is strict
id -> getId() A list of all the DOM changes。
请注意,FBJS的文档非常少,因此您将不得不尝试一些事情来使一切正常工作。
发布于 2010-10-20 04:33:15
根据this handy blog post的说法,你可以使用Facebook的Dialog对象来代替alert
对话框新对话框().showMessage(‘
’,‘这是文本’);
http://thinkclay.com/technology/getting-started-with-facebook-js-fbjs
所以你可以像这样重写你的示例代码:
<div onclick="greeting();">click me</div>
<script>
function greeting(){
new Dialog().showMessage('Dialog', "hello world");
}
</script>https://stackoverflow.com/questions/1047206
复制相似问题