FBJS...OnClick 未通过。 DHTML/setInnerXHtml 问题
非常感谢...这是问题...
我正在尝试添加动态 HTML 元素(例如[删除]),每次使用 FBJS 进行事件调用时。我都可以使用以下代码附加该元素。
var oldFriendHtml = document.getElementById('friend_container'); var numi = document.getElementById('theValue'); var num = (document.getElementById("theValue").getValue()-1)+2; numi.value = num; var newElementId = "新"+num; var newFriendHTML = document.createElement('div'); newFriendHTML.setId(newElementId); newFriendHTML.setInnerXTML("要添加的 HTML"); oldFriendHtml.appendChild(newFriendHTML);
我面临的问题是 FBJS 从添加的原始 HTML 中解析出 onClick 部分(事件调用)。这阻止了我对添加的元素进行进一步的活动。它还删除了 HTML 中添加的样式。
thanks so much in advance...here is the problem...
I am trying to add dynamic HTML element (EX. [delete]),everytime on a event call using FBJS.I am able to append the element using following code.
var oldFriendHtml = document.getElementById('friend_container');
var numi = document.getElementById('theValue');
var num = (document.getElementById("theValue").getValue()-1)+2;
numi.value = num;
var newElementId = "new"+num;
var newFriendHTML = document.createElement('div');
newFriendHTML.setId(newElementId);
newFriendHTML.setInnerXTML("HTML TO BE ADDED");
oldFriendHtml.appendChild(newFriendHTML);
The problem I am facing is that FBJS parses out the onClick part (event call ) out from the original HTML added .This stops me in the further activity on the added element .It also removes the styling added in the HTML ..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
关于从setInnerXHTML中解析出onclick,您可以稍后使用addEventListener添加事件。
这是一些示例:
更多详细信息请参阅 http://developers.facebook.com/docs/fbjs#events
Regarding onclick being parsed out of setInnerXHTML, you can add the event later by using addEventListener.
Here is some sample:
more details see http://developers.facebook.com/docs/fbjs#events