专注前端素材!
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>素材8网教程(study.sucai8.cn)</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>
运行结果