了解如何让天才为我的用户(JavaScript代码段) [英] Learn how to make Flair for my users (javascript snippets)
问题描述
我想给我的用户的一小片的JavaScript或HTML code,他们可以把自己的网站,并显示相关信息。有点像StackOverFlows新功能天才。
I wanted to give my users a little piece of JavaScript or HTML code that they could put on their site and show information about them. Kind of like StackOverFlows new feature Flair.
我对如何code这一个想法。我打算给他们一些JS与HTML是有一个DIV ID =MySite_Info。然后,JS会去我的网站和拉一些JSON或XML,然后填写资料,在我给他们在其网站上的HTML一个DIV。
I have an idea of how to code it. I was going to give them some JS with a HTML that had a DIV id="MySite_Info". Then the JS would go to my site and pull some JSON or XML and then fill in the data with a DIV in the HTML I gave them on their site.
有没有更好的方式来做到这一点?或任何的例子在网上我应该遵循?最新最好的方式来创建这些JavaScript代码段? (不知道什么是正确的名字)
Is there a better way to do this? Or any examples online I should follow? Whats the best way to create these javascript snippets? (Not sure what the proper name is)
推荐答案
有两种基本的选择。
- 图片(文字和图片吸)
- JavaScript的 - 像你描述
我会采取的做法是:
- 在动态使用服务器端程序生成的JS。这将包括用于用户数据(使用JSON发生器容易地制造在一个合适的格式的数据)。
- 在使用标准DOM方法生成的徽章
- 找到的文件ID的元素,并使用appendChild生成的徽章
这篇关于了解如何让天才为我的用户(JavaScript代码段)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!