FBML document.getElementById(‘’).setTextValue 问题
我刚刚向我的粉丝页面添加了一个 FBML 应用程序,但我无法使 JS 工作......尽管我阅读了 FBJS 最佳实践......我想我错过了一些东西。
这是当前的代码:
<form action="" method="post" target="_blank">
<input type="text" name="email" id="emailInput" onclick="document.getElementById(‘emailInput’).setTextValue(‘Hi!’);" value="votre adresse email" alt="Entrez votre email" />
<input type="hidden" name="place" value="facebook" />
<br/>
<input type="submit" name="submit" class="submitInput" value="" alt="Valider" />
</form>
onclick 事件似乎不起作用,但我无法从互联网上的研究中得到任何答案......
欢迎任何帮助;)
干杯。
戈蒂耶。
I just added a FBML application to my fan page but I can't make JS to work ... though I read the FBJS best practices ... I guess I am missing something.
here is the current code :
<form action="" method="post" target="_blank">
<input type="text" name="email" id="emailInput" onclick="document.getElementById(‘emailInput’).setTextValue(‘Hi!’);" value="votre adresse email" alt="Entrez votre email" />
<input type="hidden" name="place" value="facebook" />
<br/>
<input type="submit" name="submit" class="submitInput" value="" alt="Valider" />
</form>
The onclick event seems not to work but I can't get any answers from my research over Internet ...
Any help welcome ;)
Cheers guys.
Gotye.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 Firebug 或 Chrome 工具验证 id 是否确实是 emailInput,并且 Facebook FBML 解析器未向 ID 附加前缀。但 FBML 页面已被弃用,因此您最好切换到 iframe 粉丝页面,这样您就不会面临 Facebook 杀死您的 FBML 粉丝页面的风险。此外,JavaScript 在 iframe 页面中要容易得多,并且无需等待单击事件触发即可调用。
Use Firebug or Chrome tools to verify that the id is actually emailInput, and that the Facebook FBML parser didn't append a prefix to the ID. But FBML pages have been deprecated so you will be better off switching to an iframe fan page so you aren't running the risk of having Facebook kill your FBML fan page. Also, javascript is a ton easier in iframe pages and can be called without having to wait for a click event to fire.