![](/img/trans.png)
[英]Why HTML/JavaScript widget is not showing in my blogspot?
[英]Blogspot Template: pass widget output to javascript
我想用小部件輸出值“ <data:content />”替換YOUR_LABEL_HERE,只是想將小部件輸出傳遞給我的javascript
這是我的代碼:
<b:section class='section' id='my-html-sec-test'>
<b:widget id='HTML555' locked='true' title='MY LABEL' type='HTML' version='1'>
<b:widget-settings>
<b:widget-setting name='content'> Label </b:widget-setting>
</b:widget-settings>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
</b:if>
<div class='widget-content'>
<data:content/>
<script src="/feeds/posts/default/-/YOUR_LABEL_HERE?published&alt=json-in-script&callback=labelthumbs" type='text/javascript'> </script>
</div>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
</b:section>
您需要在src
之前使用Blogger expr
才能將小部件數據內容作為字符串傳遞
<b:section class='section' id='my-html-sec-test'>
<b:widget id='HTML555' locked='true' title='MY LABEL' type='HTML' version='1'>
<b:widget-settings>
<b:widget-setting name='content'> Label </b:widget-setting>
</b:widget-settings>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
</b:if>
<div class='widget-content'>
<script expr:src='"/feeds/posts/default/-/" + data:content + "?published&alt=json-in-script&callback=labelthumbs"' type='text/javascript'></script>
</div>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
</b:section>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.