gpt4 book ai didi

javascript - iGoogle 小工具检查器在 for 循环中抛出错误

转载 作者:行者123 更新时间:2023-11-29 15:48:51 25 4
gpt4 key购买 nike

我试图在我的 google 小工具定义中放置一个 for 循环,但是 iGoogle Gadget Checker在简单的 for 循环中抛出错误。

有没有人有这方面的经验?我应该使用不同的小工具验证器吗?

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Test Gadget">
</ModulePrefs>
<Content type="html">
<script>
for (var i=0; i<10; i++) {
console.log(i);
}
</script>
</Content>
</Module>

最佳答案

XML 要求使用 CDATA 标签定义 HTML 字符数据,以免混淆解析器。

<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Test Gadget"></ModulePrefs>
<Content type="html"><![CDATA[
<script>
for (var i=0; i<10; i++) {
console.log(i);
}
</script>
]]></Content>
</Module>

关于javascript - iGoogle 小工具检查器在 for 循环中抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8153333/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com