簡體   English   中英

如何在Firefox JavaScript中訪問非標准屬性?

[英]How do you access non-standard attributes in Firefox JavaScript?

基本上在IE中,您可以執行以下操作:

<img metaDataAtt="type5" src="..." id="tag1"/>

然后在JavaScript中執行類似

var theImg = document.getElementById("tag1");
alert(theImg.metaDataAtt);

但是,在Firefox中不能。 是否有某種解決方法?

謝謝Grae

document.getElementById('tag1').getAttribute('metaDataAtt');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM