我想在一個頁面上相互顯示兩個獨立的Tumblr博客。我希望他們看起來與他們的Tumblr主題完全相同。什麼是最好的方法來做到這一點?在一個頁面上顯示兩個獨立的Tumblr博客?
我能夠使用JavaScript導入的內容是這樣的:
<div id="tumblr1">
<script type="text/javascript" src="http://tumblr1.tumblr.com/js"></script>
<div>
<div id="tumblr2">
<script type="text/javascript" src="http://tumblr2.tumblr.com/js"></script>
<div>
但內容顯然不會樣式。有沒有更簡單的方法來做到這一點?如果沒有,是否有一種簡單的方式來設置我從js獲得的內容的樣式?
UPDATE:
我正在解析JSON的JavaScript,但不順心的屬性值的破折號。舉個簡單的例子:
<script type="text/javascript">
var tumblelog = {
"title":"Tumblr Title",
"description":"Tumblr Description",
"name":"tumblr name",
"timezone":"US\/Central",
"cname":false,
"feeds":0,
"posts-start":0,
"posts-total":"111",
"posts-type":false
};
</script>
<script type="text/javascript">
document.write(tumblelog.posts-total);
</script>
告訴我「未捕獲的ReferenceError:總沒有定義」。然而,
<script type="text/javascript">
document.write(tumblelog.feeds);
</script>
返回0就好了。 Tumblr的API建議像
document.write(tumblelog['@posts-total']);
當使用但返回「undefined」。
有什麼建議嗎?