编辑下面的代码:【加编码】
<html> <head> <link id="link1" href="/demo/domoarigato.htm" hreflang="ja"> <script> function displayResult() { var x=document.getElementById("link1").hreflang; alert(x); } </script> </head> <body> <button type="button" onclick="displayResult()">Display hreflang of link element</button> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂