摘要:当我尝试使用带有脚本属性的amp-script标记时,它声称看不到该脚本。
这是不起作用的代码:
/**
saves the top snake of the parameter no. species if
it has a better score than any of the legends
**/
void saveTopsnake(int speciesno) {
Table t;
t = new Table();
//load the data about which legend spaces have already been assigned a snake
loadTable("Downloads/snakesStored.xlsx");
int snakeNo;
snakeNo = new Integer(-1);
TableRow tr = t.getRow(0);
for (int i = 0; i< t.getcolumnCount(); i++) {
if (tr.getInt(i) == 0) {
snakeNo = i; break;
}
}
我尝试了1)将name =“ navToggleScript”添加到脚本标签,以及2)使脚本成为amp-script的子级,而不是同级的子级。无论我做什么,在Chrome,Firefox Dev Edition和Safari中仍然会出现以下错误:<amp-script layout="container" script="navToggleScript">
<h3 class="nav-toggle icon"><a href="#navigation">Menu</a></h3>
</amp-script>
<script type="text/plain" target="amp-script" id="navToggleScript">
document.querySelector(".nav-toggle.icon").textContent += 'Hello world!';
</script>
。我究竟做错了什么?在我看来,我正在按照这封信的documentation中的说明进行操作。我将不胜感激!