Edit comment box script to be dynamic

冷暖自知 提交于 2019-12-12 19:17:59

问题


in order to edit the script of facebook plugin comment box to be dynamic and displays comments related to each post separately, I've added these 2 lines of code into the script :

var related = document.getElementById('fb-related');
related.setAttribute("data-href", "articles.aspx?art_id=<%# Request.QueryString["art_id"] %>"); ... (the rest of code) </script>  

and this is the div where the comment box appear

<div id="fb-related" class="fb-comments" data-numposts="5" data-colorscheme="light"></div>

but nothing happens and the comment box doesn't appear at all ,or appears saying The comments plugin requires an href parameter. !! any help please ?

note that I'm using asp.net with C#


回答1:


Put the data-href attribute in CodeBehind on the PageLoad event with C# code so when the page renders the plugin will already have a data-href



来源:https://stackoverflow.com/questions/20839387/edit-comment-box-script-to-be-dynamic

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!