需要在 Google 小工具中添加源属性吗?
所以我一直在尝试为 google 网站制作一个小工具,并创建了两个选项来将 url 插入 .ogg 和 .mp3 文件。这是我的代码:
<UserPref name="ogguri" display_name="Url to your .ogg file" datatype="string" required="true" />
<UserPref name="mp3uri" display_name="Url to your .mp3 file" datatype="string" required="true" />
<Content type="html">
<script>
gadgets.util.registerOnLoadHandler(doRender);
function doRender(){
var prefs = new gadgets.Prefs();
var ogguri = prefs.getString('ogguri');
var mp3uri = prefs.getString('mp3uri');
var ogg = document.getElementById("ogg");
var mp3 = document.getElementById("mp3");
//add proper attributes
ogg.setAttribute("src", "ogguri");
mp3.setAttribute("src", "mp3uri");
}
</script>
我遇到了麻烦,因为 元素的输出添加了 src 属性,但它打印为
src="ogguri"
或 < code>src="mp3uri" 我无法确定问题出在哪里或者我应该做什么。在我看来,ogguri 和 mp3uri 没有得到定义。
so I've been trying to make a gadget for google sites and have created two options to insert urls to a .ogg and .mp3 files. Here is my code:
<UserPref name="ogguri" display_name="Url to your .ogg file" datatype="string" required="true" />
<UserPref name="mp3uri" display_name="Url to your .mp3 file" datatype="string" required="true" />
<Content type="html">
<script>
gadgets.util.registerOnLoadHandler(doRender);
function doRender(){
var prefs = new gadgets.Prefs();
var ogguri = prefs.getString('ogguri');
var mp3uri = prefs.getString('mp3uri');
var ogg = document.getElementById("ogg");
var mp3 = document.getElementById("mp3");
//add proper attributes
ogg.setAttribute("src", "ogguri");
mp3.setAttribute("src", "mp3uri");
}
</script>
I am having trouble as the out put of the <audio>
elements adds the src attribute but it prints out as src="ogguri"
or src="mp3uri"
I am having trouble seeing where the problem is or what I should do. It seems to me that the ogguri and mp3uri are not getting defined.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论