问题描述
我正在从事一个班级项目,我正在创建一个 Google 地球项目并为项目中的每个位置自定义信息框。 (此处的项目链接:https://earth.google.com/earth/d/1mJl_DRSTJqYvKIzLOUnTrEeUiMIbJh6H?usp=sharing)
在信息框上,我有一个按钮来显示更多的内容,它的代码如下:(项目中标题为Cenacle的第2页代码)
<script>
let state = "hidden";
function historicFactsFunc() {
if (state === "hidden") {
jQuery("#historicFacts")[0].innerHTML = "<p>Scholars don't think this is the correct site</p>";
state = "visible";
} else {
jQuery("#historicFacts")[0].innerHTML = "";
state = "hidden";
}
};
</script>
<div class="place">
<h3>About the Cenacle</h3>
<p class="placetxt">Cenacle,also ..text..</p>
<button onclick="historicFactsFunc()">Is it historically accurate?</button>
<div id="historicFacts"></div>
</div>
当我在本地将其作为独立网站进行测试时,它运行良好。当我将 Google 地球项目的信息框作为 HTML 嵌入时,它会在我单击按钮时引发错误:Uncaught TypeError: historicFactsFunc is not a function at HTMLButtonElement.onclick (about:srcdoc:1:1)
。为什么会发生这种情况,我该如何使其发挥作用?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)