JavaScript 参考手册
Meta content 属性
显示所有 meta 属性内容
源代码:
点击运行 »
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>蜜蜂教程(mifengjc.com)</title> <meta name="keywords" content="HTML, DHTML, CSS, XHTML, JavaScript"> <meta name="description" content="Free Web tutorials"> <meta name="author" content="Hege Refsnes"> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"> <script> function displayResult() { var x = document.getElementsByTagName("meta"); var txt = ""; for (var i = 0; i < x.length; i++) { txt = txt + "Content of " + (i + 1) + ". meta tag: " + x[i].content + "<br>"; } document.getElementById("result").innerHTML = txt; } </script> </head> <body> <button type="button" onclick="displayResult()">显示 Meta 内容</button> <p id="result"></p> </body> </html>
运行结果:
点击运行 »