1
我在Google網站中增量構建HTML,我需要用超鏈接替換某些內容。儘管如此,根據文檔<a>
標籤是不允許的。Google網站應用程序腳本用超鏈接創建HTML
所以...我如何在以下示例中將anchor
轉換爲可以附加的HTML字符串?
for(var ii=1; ii < strings.length; ii++) {
html += "<h2>An item</h2>";
html += "<div class='item'>";
anchor = app.createAnchor("click for further info...", "http://x.com?id=y");
html += strings[ii].replace(/<link>/g, anchor);
html += "</div>";
}
app.add(app.createHTML(html));
我不認爲.add(anchor)
會在這種情況下工作,因爲我需要更換一個佔位符字符串。