FBML document.getElementById(‘’).setTextValue 问题

发布于 2024-11-18 03:30:27 字数 627 浏览 7 评论 0原文

我刚刚向我的粉丝页面添加了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

千秋岁 2024-11-25 03:30:27

使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文