Google マップの情報ウィンドウを作成しようとしていますが、情報を表示する動的フォームを生成する必要があります。
次のスクリプトは、「No_found_err: DOM exception 8」というエラーを生成します。
//create objects for HTML elements
var inputElement1 = document.createElement("input");
var inputElement2 = document.createElement("input");
//assign different attributes to the element
inputElement1.setAttribute("type", "text");
inputElement1.setAttribute("id", "poiName");
inputElement2.setAttribute("type", "textarea");
inputElement2.setAttribute("id", "poiDesc");
//create style tag, atrributes and values
//add css style to head tag and define classname for HTML "desctag" element
var cssNode = document.createElement("style");
cssNode.setAttribute("type", "text/css");
cssNode.style.cssText = ".cssClass {vertical-align: text-top; width: 250px; height: 150px }";
document.getElementsByTagName("head")[0].appendChild("cssNode");
document.getElementById("poiDesc").className = "cssClass";
var formString = "<b>Enter location details:</b>
<p>Name: " +
" " + inputElement1 + "<br>Description: " + inputElement2 +
"<p><center>" + "<input type='button' id='saveBtn' value='Save' onclick='savePOI()'>
</center>";
//insert values into the form elements
document.getElementById("poiName").value = locList[i].name;
**document.getElementById("poiDesc").value = locList[i].desc;**
このエラーは、最後の 2 行の間に表示されます。タグ ID "poiName" および/または "poiDesc" が作成されていないということですか?
上記の問題を解決するにはどうすればよいですか?
ありがとうございました。