我有一些問題將字符串變量傳遞給方法RequirementPopup。這個方法需要三個參數id,typeId和objType(例如一個對象的類型,例如它是「Item」)爲什麼我得到[對象HTMLImageElement]?
第一個方法其中是執行其他方法的按鈕,其中傳遞了三個變量。
function EditForm(count, id, typeId, nr, objType, name, lat, lon) {
/* Here is something else */
<p><input type="button" id="edit-requirement" value="Edit requirement" onclick="javascript:RequirementPopup('+id+','+typeId+','+objType+')"/></p>
}
其假設,以顯示我們的變量,是通過第二種方法:
function RequirementPopup(id, typeId, objType) {
/* Here is something else */
document.getElementById("id").value = id;
document.getElementById("tid").value = typeId;
document.getElementById("oType").value = objType;
}
在DIV ID和TID我得到正確的變量,但在oType我得到[對象HTMLImageElement],而不是「項目」?
PS當我EditForm方法警報顯示OBJTYPE比如它是正確的,但是當我將它傳遞給RequirementPopup方法我越來越像[對象HTMLImageElement]
誰能告訴我,爲什麼它是發生和如何解決這個問題?