<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <a id="runoob" charset="ISO-8859-1" href="//www.runoob.com/">菜鸟教程</a><br> <script> document.write("返回链接的charset: "); document.write(document.getElementById('runoob').charset); document.write("<br><br>"); </script> <a id="google" href="//www.google.com/">Google</a><br> <script> document.getElementById('google').charset="utf-8"; document.write("设置链接的charset: "); document.write(document.getElementById('google').charset); </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <p><a id="runoob" href="//www.runoob.com/">菜鸟教程</a></p> <script> document.write("返回 href 链接: "); document.write(document.getElementById('runoob').href); </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <a id="runoob" hreflang="zh-cn" href="//www.runoob.com/">菜鸟教程</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>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <p><a href="#C6">参见第6章</a></p> <h2>第1章</h2> <p>这一章解释了 ba bla bla</p> <h2>第2章</h2> <p>这一章解释了 ba bla bla</p> <h2>第3章</h2> <p>这一章解释了 ba bla bla</p> <h2>第4章</h2> <p>这一章解释了 ba bla bla</p> <h2>第5章</h2> <p>这一章解释了 ba bla bla</p> <h2><a id="c6" name="C6">第6章</a></h2> <p>这一章解释了 ba bla bla</p> <script> document.write("返回锚: "); document.write(document.getElementById("c6").name); </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <p><a id="func" rel="friend" href="//www.functravel.com/">优惠航班</a></p> <script> document.write("当前文档和链接的文档之间的关系: "); document.write(document.getElementById("func").rel); </script> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> <script> function changeTarget(){ document.getElementById('runoob').target="_blank"; } </script> </head> <body> <a id="runoob" href="//www.runoob.com">访问菜鸟教程</a> <br><br> <input type="button" onclick="changeTarget()" value="修改target"> <p>尝试在你单击按钮之前点击链接。</p> </body> </html>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟教程(runoob.com)</title> </head> <body> <p><a id="runoob" type="text/html" href="//www.runoob.com">菜鸟教程</a></p> <script> document.write("返回链接的type属性值:"); document.write(document.getElementById("runoob").type); </script> </body> </html>