可能重複:
How do I get the information from a meta tag with javascript?將元標記的內容返回給JavaScript變量?
我有一個meta標籤中的內容可以自定義頁面上填寫,而我需要的內容作爲JavaScript變量。
可能重複:
How do I get the information from a meta tag with javascript?將元標記的內容返回給JavaScript變量?
我有一個meta標籤中的內容可以自定義頁面上填寫,而我需要的內容作爲JavaScript變量。
http://www.webmasterworld.com/javascript/3224334.htm有示例代碼,請參閱其討論以獲取更多信息。
function getMetaContents(mn){
var m = document.getElementsByTagName('meta');
for(var i in m){
if(m[i][i].name == mn){
return m[i].content;
}
}
}
http://WhatHaveYouTried.com – 2012-06-28 19:44:49
有意詳細說明嗎? –