源代码 :
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>开源教程(ossoft.cn)</title> </head> <body> <a id="runoob" hreflang="zh-cn" href="/">开源教程</a><br> <script> document.write("返回链接的hreflang: "); document.write(document.getElementById('runoob').hreflang); document.write("<br><br>"); </script> <a id="google" href="//www.google.com/">Google</a><br> <script> document.getElementById('google').hreflang="no"; document.write("设置链接的hreflang: "); document.write(document.getElementById('google').hreflang); </script> </body> </html>
运行结果